Java Reference
In-Depth Information
Figur e 10•17. The WebBr owser component
Another thing to notice about this example is that it demonstrates several other
example classes that are developed later in this chapter. GUIResourceBundle ,
which is developed in Example 10-22, is the primary one. This class allows com-
mon GUI resources (such as colors and fonts) to be read from textual descriptions
stored in a properties file, which therefore allows the resources to be customized
and localized. When GUIResourceBundle is extended with ResourceParser imple-
mentations, it can parse more complex “resources,” such as entire JMenuBar and
JToolBar components. WebBrowser defers the creation of its menus and toolbars to
GUIResourceBundle .
The WebBrowser class uses the default Metal look-and-feel, but it allows the user to
select “theme” (a color and font combination) for use within that look-and-feel.
This functionality is provided by the ThemeManager class, which is developed in
Example 10-28. The printing capability of the web browser is provided by the
PrintableDocument class, which is developed in Chapter 12, Printing .
Example 10•21: WebBrowser.java
package com.davidflanagan.examples.gui;
import java.awt.*;
// LayoutManager stuff
import javax.swing.*;
// Swing components
import java.awt.event.*;
// AWT event handlers
Search WWH ::




Custom Search