So. I have the following method that is called to create Check Boxes:
//function to create check boxes and add them to frame ( complete with action listeners ) public void addCheckButton(int i){ String ButtonNum = Integer.toString(i); JCheckBox select = new JCheckBox(ButtonNum); select.setBackground(new Color(56,48,44)); select.setForeground(new Color(225,255,255)); con.add(select); select.addActionListener(this); }
I am creating these buttons in my implemention like so:
//add our check-buttons for (int i=0; i<35; i++){ lottery.addCheckButton((i+1)); }
I want to disable all of my created checkboxes when 6 are selected. I am using the action listener event like so:
public void actionPerformed(ActionEvent evt) { //String Action= evt.paramString(); this.check_six++; if (this.check_six<=6){ JOptionPane.showMessageDialog(frame, "Action id: " + check_six); } else { JOptionPane.showMessageDialog(frame, "MAX"); //DISABLE CHECK BUTTONS HERE! } }
Does any one have a solution for this that would work with my current setup?
thx