Java Reference
In-Depth Information
on the internet
All code found in this Appendix is available:
BorderTest.java
Simple illustration of the BorderLayout , shown in Fig-
ure B.6.
BasicGUI.java
The main example for the GUI application used in
this chapter, with CloseableFrame from Figure B.14.
exercises
IN SHORT
B.1
What is a GUI?
List the various JComponent classes that can be used for GUI input.
B.2
Describe the difference between heavyweight components and lightweight
components and give examples of each.
B.3
What are the differences between the JList and JComboBox components?
B.4
What is a ButtonGroup used for?
B.5
Explain the steps taken to design a GUI.
B.6
Explain how the FlowLayout , BorderLayout , and null layouts arrange com-
ponents.
B.7
Describe the steps taken to include a graphical component inside a JPanel .
B.8
What is the default behavior when an event occurs? How is the default
changed?
B.9
What events generate an ActionEvent ?
B.10
How is the window-closing event handled?
B.11
IN PRACTICE
B.12 paintComponent can be written for any component. Show what happens
when a circle is painted in the GUI class instead of its own canvas.
Handle the pressing of the Enter key in the y -coordinate text field in class
GUI .
B.13
Add a default of (0, 0) for the coordinates of a shape in class GUI .
B.14
 
Search WWH ::




Custom Search