How to use JCheckbox array in JPanel array

SASCOMP

New Member
I am trying to create a layout with an array of 12 JPanels each containing an array of 35 JCheckboxes. The problem I am having is that although the panels and checkboxes all display fine on the form, I have no way of accessing the properties of the individual checkboxes.Here is part of the code I use:\[code\]JPanel panel_south = new JPanel();contentPane.add(panel_south, BorderLayout.SOUTH);panel_south.setLayout(new GridLayout(3, 4, 1, 1));for(Integer i =0; i<12;i++){ Integer title = i+1; EtchedBorder border = new EtchedBorder(EtchedBorder.LOWERED, null, null); TitledBorder titled = new TitledBorder(border,title.toString()); row = new JPanel(); row.setBorder(titled); row.setLayout(new GridLayout(6, 6, -6, -5)); panel_south.add(row); JCheckBox[] rad = new JCheckBox[35]; for (int j = 0;j<35;j++){ rad[j] = new JCheckBox(); row.add(rad[j]); }\[/code\]When I try to use a line like this in the for loop:row.rad[j].setSelected(true);I get the error: rad cannot be resolvedWhat am I doing wrong here?
 
Back
Top