Question: 1) How do you program your Swing application to do something when a button is clicked? 1-Implement the actionPerfmed() method directly within the JButton class
1) How do you program your Swing application to do something when a button is clicked?
| 1-Implement the actionPerfmed() method directly within the JButton class |
| 2-Create a new class that implements ActionListener with an actionPerformed() method that performs the action |
| 3-The application's main() method performs all such activities |
| 4-Define a custom subclass of JButton in order for any actions to be taken |
2)Which Swing GUI element allows text entry from the program user?
| 1-JRadioButton |
| 2-JPanel |
| 3-JComboBox |
| 4-JButton |
3)What is the containment (nesting) order of a button within a typical Swing application, starting from its top-most container (window)?
| 1-Panel, frame, button |
| 2-Frame, panel, button |
| 3-Frame, button, panel |
| 4-Button, panel, frame |
4)Which of the following best defines the job of a Swing ButtonGroup?
| 1-Places the buttons close to each other in the container |
| 2-Arranges the group of buttons solely for presentation purposes |
| 3-Assures only one button in the group is selected at a time |
| 4-Groups checkboxes together to allow multiple choices |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
