views:

24

answers:

1

Hello everyone, 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);
...
+2  A: 

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).

Michael Borgwardt
Thank you......
Jessy