문제

I am using a BorderLayout, 3 Containers with GridLayout and an array of 8 JLabels. The Container #1 uses 2 JLabels, the Container #2 uses 2 JLabels and the Container #3 uses 2 JLabels as well. I include Container #1 North, works fine. The Container #2 Center, works fine, the Container #3 South, works fine too. But when I come to include 1 JLabel of the array East and 1 JLabel West they don't show up, I don't know why and I've spend hours searching for it. Pretty much:

add("North", con1);
add("Center", con2);
add("South", con3);
add("East", myarray[6]);
add("West", myarray[7]); 

What am I doing wrong? D: Thanks a lot

도움이 되었습니까?

해결책

You have to add the JLabels to own Panels, then add the Panels to your BorderLayout.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top