Blakes 21 Days Chapter 10 Document


Day 10, Building a Swing Interface

Swing Features

Standard Dialog Boxes

Figure 10.1 "a standard dialog box" goes here !

Confirm Dialog Boxes

Figure 10.2 goes here

Input Dialog Boxes

Figure 10.3 goes here

Option Dialog Boxes

Figure 10.5 goes here

Using Dialog Boxes

Listing 10.1 The Full Text of FeedInfo.java

An Explanation

Figure 10.6 goes here

Sliders

Figure 10.7 goes here

Second Program

Listing 10.2 The Full Text of Slider.java

Explanation

Scroll Panes

Toolbars

Third Program

Figure 10.8 A dockable toolbar and a text area - goes here!

LISTING 10.3 The Full Text of FeedBar.java

The Explanation

Progress Bars

Figure 10.9 A progress bar in a frame, goes here!

Fourth Program

LISTING 10.4 The Full Text of ProgressMonitor.java

The Explanation

Menus

Figure 10.10 - A frame with a menu bar - goes here

Fifth Program

LISTING 10.5 The Full Text of FeedBar2.java

The Explanation

Tabbed Panes

Sixth Program

LISTING 10.5 The Full Text of TabPanels.java

The Explanation

Figure 10.11 - A tabbed pane with five tabs - goes here



Summary



Q & A



Quiz - Questions

  1. Which user interface component is common in software installation programs ?
    1. Sliders
    2. Progress bars
    3. Dialog boxes

  2. Which Java package includes a class for clickable buttons ?
    1. java.awt (Abstract Windowing Toolkit)
    2. javax.swing (Swing)
    3. Both

  3. Which user interface component can be picked up and moved around ?
    1. JSlider.
    2. JToolbar
    3. Both

Answers

  1. B. Progress bars are useful when used to display the progress of a file-copying or file-extracting activity.
  2. C. Swing duplicates all the simple user interface components included in the Abstract Windowing Toolkit.
  3. B. The toolbar can be dragged to the top, right, left, or bottom of the interface and also out of the interface.


Certification Practice

  1. What will happen when you compile and run this source code ?
    1. It compiles without error and runs correctly.
    2. It compiles without error but does not display anything in the frame.
    3. It does not compile because of the super() statement.
    4. It does not compile because of the add() statement.


Exercise