I want to have a JFrame that displays 5 different check boxes. Multiple checkboxes should be able to be selected. This code only reads the ExchangingCard1 line and ignores all other checkboxes. When you run it you will have only one checkbox with "A" as the character.
JCheckBox ExchangingCard1 = new JCheckBox("A");
JCheckBox ExchangingCard2 = new JCheckBox("B");
JCheckBox ExchangingCard3 = new JCheckBox("C");
JCheckBox ExchangingCard4 = new JCheckBox("D");
JCheckBox ExchangingCard5 = new JCheckBox("E");
JFrame frame = new JFrame();
frame.setSize(500, 500);
frame.setTitle("Exchange.");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(ExchangingCard1);
frame.setVisible(true);
frame.add(ExchangingCard2);
frame.setVisible(true);
frame.add(ExchangingCard3);
frame.setVisible(true);
frame.add(ExchangingCard4);
frame.setVisible(true);
frame.add(ExchangingCard5);
frame.setVisible(true);
Aucun commentaire:
Enregistrer un commentaire