public void actionPerformed(ActionEvent event) { Component[] components = selectorPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component comp = components[i]; if (comp instanceof CPCheckBox) { CPCheckBox scb = (CPCheckBox) comp; scb.setState(enb); } } }
public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { JMenuItem item = (JMenuItem) e.getSource(); String name = item.getText(); Profile profile = profiles.getProfile(name); Component[] components = selectorPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component comp = components[i]; if (comp instanceof CPCheckBox) { CPCheckBox scb = (CPCheckBox) comp; String id = scb.element.id; boolean enb = profile.has(id); scb.setState(enb); } } } }