Home Page
>
Creating a GUI with JFC/Swing
Questions and Exercises: Learning Swing by Example
Questions
- On what thread should GUIs be created, to guarantee thread safety?
-
Why should you be careful to minimize the time spent in event-handler code?
-
What is the purpose of the setLabelFor method?
-
What is the content pane?
-
Describe the three code segments that must be implemented for an event handler.
-
Which text component is best suited for controlling the format of a single line of user-entered text?
-
What is lazy image loading and why would you use it?
Exercises
1.
Write the code that creates a label displaying the following text,
with the italics and font size as shown in this screenshot:
2. Convert the
LunarPhases
example to use radio buttons instead of a combo box.
3. Add a Show Dialog check box to the VoteDialog
example so that the dialogs are shown only if this check box
is selected.
Check your answers