This is the (relevant) code I used a while ago:
Declare as a global variable in your class
CODE
private JPanel checkspanel = new javax.swing.JPanel();
private JCheckBox[][] seat_checks;
If you have a function that handles the generation of all the components (windows, buttons, ...) then you have to add these lines to it
CODE
checkspanel.setLayout(new java.awt.GridLayout(8,12));
checkspanel.setBorder(javax.swing.BorderFactory.createTitledBorder("The checkboxes"));
for (int i=0;i<8;i++) {
for (int j=0;j<12;j++) {
seat_checks[i][j] = new JCheckBox("");
seat_checks[i][j].addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent order_btn_evt) {
checkboxActionPerformed(order_btn_evt);
}
seat_checks[i][j].setMargin(new java.awt.Insets(3, 3, 3, 3));
checkspanel.add(seat_checks[i][j]);
}
}
This will create a JPanel with the 8x12 checkbox grid. The only thing left to do is add that panel to your layout

.
I'm not 100% sure about that ActionListener, I've never used that in my application, but it might be a good start. My guess is that the checkboxActionPerformed function gets the handler for the checkbox so it can check wether the checkbox is ticked or not. Then it's just a matter of adding or removing the checkbox's name to a list (btw. if you realy want to give them a human readable name, then you'll have to create an 12x8 string array with those names

)
Comment/Reply (w/o sign-up)