Note that there are some explanatory texts on larger screens.

plurals
  1. POI need to add listeners to the checkboxes and changes in selection is shown in the textArea
    primarykey
    data
    text
    <pre><code>import javax.swing.*; import java.awt.event.*; import java.awt.*; public class JDorm implements ItemListener{ public static void main(String[] args){ JCheckBox privateroom = new JCheckBox("Private Room",false); JCheckBox interweb = new JCheckBox("Internet Connection",false); JCheckBox cable = new JCheckBox("Cable TV connection",false); JCheckBox fridg = new JCheckBox("Refridgerator",false); JCheckBox microwave = new JCheckBox("Microwave",false); JCheckBox soon = new JCheckBox(",and so on",false); JLabel greet = new JLabel("Please choose ammenities"); String sel = "Your selected options"; JTextArea textBox = new JTextArea(sel,0,1); cable.addItemListener(); JFrame dormFrame = new JFrame("Dorm Options");// creates frame with title final int WIDTH = 250; final int HEIGHT = 500; dormFrame.setSize(WIDTH, HEIGHT);// sets the size of frame in pixels dormFrame.setVisible(true);// note: default visibility is false dormFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dormFrame.setLayout(new FlowLayout()); dormFrame.add(greet); dormFrame.add(microwave); dormFrame.add(fridg); dormFrame.add(cable); dormFrame.add(interweb); dormFrame.add(privateroom); dormFrame.add(soon); dormFrame.add(textBox); } public void itemStateChanged(ItemEvent event){ Object source = event.getSource(); int select = event.getStateChange(); } } </code></pre> <p>This is what I have so far, I know I need listeners, and a message to appear in the box when selection is checked and unchecked. Do I need if statements for the changes?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload