문제

How can I add two label in the same grid box? e.g. in row 1, col 1 the will be 2 labels? The code below will add the label in two different grid.

JPanel chckBox = new JPanel(new GridLayout(1,8,3,3)); 

JLabel label1 = new JLabel("A");
JLabel label2 = new JLabel("B");
...
chckBox.add(label1);
chckBox.add(label2);
...
도움이 되었습니까?

해결책

Put a JPanel into that part of the grid and have the two labels as children of that panel (which can have its own layout manager).

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