I got two Classes:
1) Panel A
2) Panel B
On Panel A, I got a checkbox, which (if selected) should set Panel B visible. This is what I got so far:
public class PanelA extends JPanel {
public static JCheckBox shopBox;
public PanelA() {
setVisible(PanelB.checkBox.isSelected());
}
}
And this is a part of JPanel B:
checkBox = new JCheckBox("Show PanelA");
add(checkBox);
checkBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//PanelA.setVisible(virusBox.isSelected());
}
});
Now this doesnt work. How can I make JPanelB visible/invisible regarding the state of the JCheckBox on JPanelA??
Greetings
Aucun commentaire:
Enregistrer un commentaire