Question | Answer |
What is the syntax for making a JTextField? | JTextField field = new JTextField(nColumns); JTextField field = new JTextField("your name"); |
What is the syntax for making a JTextArea? | JTextArea text = new JTextArea(lines, columns); |
What is the syntax for making a JCheckBox? | JCheckBox check = new JCheckBox("Goes to 11"); |
What is the syntax for making a JList? | JList list = new JList(listEntries); |
What is the syntax to register for a JCheckBox item event? | check.addItemListener(this); |
What is the syntax to select or deselect a JCheckBox? | check.setSelected(true); check.setSelected(false); |
What syntax to use to restrict the user to selecting only ONE thing at a time in JList? | list.setSelectionMode (ListSelectionModel. SINGLE_SELECTION); |
What is the syntax to register for a JList list selection event? | list.addListSelectionListener(this); |
What is the method for handling a JCheckBox item event? | public void itemStateChanged(ItemEvent ev) {..} |
What is the method for handling a JList list selection event? | public void valueChanged(ListSelectionEvent lse) {..} |
What is the syntax for turning on line wrapping for a JTextArea object? | text.setLineWrap(true); |
Want to create your own Flashcards for free with GoConqr? Learn more.