| |
| |
Preface | |
| |
| |
Intended audience | |
| |
| |
How this book is organized | |
| |
| |
Conventions | |
| |
| |
Obtaining the source code | |
| |
| |
Special thanks | |
| |
| |
Review process for this book | |
| |
| |
About the cover illustration | |
| |
| |
| |
Getting started | |
| |
| |
| |
A Java refresher | |
| |
| |
| |
What is Java? | |
| |
| |
| |
What is AWT? | |
| |
| |
| |
The Java event models | |
| |
| |
Java 1.0 | |
| |
| |
Java 1.1 and beyond | |
| |
| |
| |
JavaBeans | |
| |
| |
| |
A review of components, listeners, and events | |
| |
| |
| |
Layout manager refresher | |
| |
| |
BorderLayout | |
| |
| |
CardLayout | |
| |
| |
FlowLayout | |
| |
| |
GridLayout | |
| |
| |
GridBagLayout | |
| |
| |
Combining multiple layouts | |
| |
| |
| |
Minimum software requirements | |
| |
| |
| |
Delivering a final product | |
| |
| |
| |
Just-In-Time compilers | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Swing basics | |
| |
| |
| |
What is JFC? | |
| |
| |
| |
What is Swing? | |
| |
| |
Swing package overview | |
| |
| |
| |
Why use Swing? | |
| |
| |
JavaBeans compliance | |
| |
| |
Lightweight framework | |
| |
| |
Interaction with external resources | |
| |
| |
| |
Model-View-Controller architecture | |
| |
| |
How MVC works | |
| |
| |
What can MVC accomplish? | |
| |
| |
Custom rendering | |
| |
| |
Custom data models | |
| |
| |
| |
Delegates | |
| |
| |
What are delegates? | |
| |
| |
The ComponentUI class | |
| |
| |
| |
Pluggable LookAndFeel | |
| |
| |
| |
Creating UI objects | |
| |
| |
Creating a simple component | |
| |
| |
| |
JComponent, the mother of Swing | |
| |
| |
Pluggable look and feel | |
| |
| |
Keystroke handling | |
| |
| |
Action objects | |
| |
| |
Borders | |
| |
| |
Accessibility | |
| |
| |
Other features of JComponent | |
| |
| |
Controlling component size | |
| |
| |
JComponent hierarchy | |
| |
| |
JComponent constants | |
| |
| |
JComponent fields | |
| |
| |
JComponent constructors | |
| |
| |
JComponent significant method groupings | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Using Swing components | |
| |
| |
| |
Frames and panels | |
| |
| |
| |
JFrame | |
| |
| |
A JFrame application | |
| |
| |
JFrame hierarchy | |
| |
| |
JFrame variables | |
| |
| |
JFrame constructors | |
| |
| |
JFrame significant method groupings | |
| |
| |
| |
JApplet | |
| |
| |
A JApplet sample applet | |
| |
| |
JApplet hierarchy | |
| |
| |
JApplet variables | |
| |
| |
JApplet constructors | |
| |
| |
JApplet significant method groupings | |
| |
| |
| |
Creating simple panels | |
| |
| |
JPanel hierarchy | |
| |
| |
JPanel constructors | |
| |
| |
| |
Simple border types | |
| |
| |
Creating a custom border class | |
| |
| |
| |
Compound border creation | |
| |
| |
| |
Swing layout managers | |
| |
| |
| |
JRootPane in detail | |
| |
| |
JRootPane hierarchy | |
| |
| |
JRootPane variables | |
| |
| |
JRootPane constructors | |
| |
| |
JRootPane significant method groupings | |
| |
| |
| |
Layered panes | |
| |
| |
Layered pane basics | |
| |
| |
A layered pane example | |
| |
| |
JLayeredPane hierarchy | |
| |
| |
JLayeredPane constants | |
| |
| |
JLayeredPane variables | |
| |
| |
JLayeredPane constructors | |
| |
| |
JLayeredPane significant method groupings | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Tabbed panes, scroll panes, and split panes | |
| |
| |
| |
Tabbed panes | |
| |
| |
Creating a tabbed pane | |
| |
| |
Adding and inserting pages | |
| |
| |
Removing pages | |
| |
| |
Selecting pages | |
| |
| |
Adding images to tabs | |
| |
| |
Enabling and disabling tabs | |
| |
| |
A complete JTabbedPane example | |
| |
| |
JTabbedPane hierarchy | |
| |
| |
JTabbedPane variables | |
| |
| |
JTabbedPane constructors | |
| |
| |
JTabbedPane significant method groupings | |
| |
| |
| |
Scrolling panes | |
| |
| |
An example using JScrollPane | |
| |
| |
Controlling the scroll bars | |
| |
| |
Controlling the scrolling programmatically | |
| |
| |
Controlling the size of scroll bars | |
| |
| |
Creating scrollable components | |
| |
| |
JScrollPane hierarchy | |
| |
| |
JScrollPane constructors | |
| |
| |
JScrollPane significant method groupings | |
| |
| |
| |
Split panes | |
| |
| |
Setting the divider size | |
| |
| |
Controlling the divider position | |
| |
| |
Intercepting JSplitPane events | |
| |
| |
JSplitPane hierarchy | |
| |
| |
JSplitPane constants | |
| |
| |
JSplitPane variables | |
| |
| |
JSplitPane constructors | |
| |
| |
JSplitPane significant method groupings | |
| |
| |
| |
Advanced scrolling | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Labels and buttons | |
| |
| |
| |
Basic user interface components | |
| |
| |
| |
Labels | |
| |
| |
A JLabel sample program | |
| |
| |
Setting fonts and colors | |
| |
| |
Text alignment | |
| |
| |
Adding an image to a label | |
| |
| |
JLabel hierarchy | |
| |
| |
JLabel variables | |
| |
| |
JLabel constructors | |
| |
| |
JLabel significant method groupings | |
| |
| |
| |
AbstractButton | |
| |
| |
Listening for button events | |
| |
| |
Adding icons to buttons | |
| |
| |
Enabling and disabling buttons | |
| |
| |
Adding a keyboard mnemonic | |
| |
| |
AbstractButton variables | |
| |
| |
AbstractButton significant method groupings | |
| |
| |
| |
Push buttons | |
| |
| |
Default buttons | |
| |
| |
JButton constructors | |
| |
| |
The JButton API | |
| |
| |
| |
Toggle buttons | |
| |
| |
JToggleButton hierarchy | |
| |
| |
JToggleButton constructors | |
| |
| |
| |
Check boxes | |
| |
| |
Special layout considerations | |
| |
| |
JCheckBox hierarchy | |
| |
| |
JCheckBox constructors | |
| |
| |
| |
Radio buttons | |
| |
| |
JRadioButton hierarchy | |
| |
| |
JRadioButton constructors | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Text management | |
| |
| |
| |
JTextComponent | |
| |
| |
Clipboard operations | |
| |
| |
Saving and loading | |
| |
| |
JTextComponent hierarchy | |
| |
| |
JTextComponent constants | |
| |
| |
JTextComponent constructors | |
| |
| |
JTextComponent significant method groupings | |
| |
| |
| |
Document handling | |
| |
| |
Document constants | |
| |
| |
Document significant method groupings | |
| |
| |
| |
Text fields and password fields | |
| |
| |
Associating keyboard mnemonics | |
| |
| |
Special event handling | |
| |
| |
JTextField hierarchy | |
| |
| |
JTextField constructors | |
| |
| |
JPasswordField hierarchy | |
| |
| |
JPasswordField Features | |
| |
| |
JPasswordField constructors | |
| |
| |
JPasswordField significant method groupings | |
| |
| |
| |
Text areas | |
| |
| |
JTextArea hierarchy | |
| |
| |
JTextArea constructors | |
| |
| |
JTextArea significant method groupings | |
| |
| |
| |
Combo boxes | |
| |
| |
Adding and removing list items | |
| |
| |
Selecting items | |
| |
| |
Allowing field editing | |
| |
| |
Other combo box tricks | |
| |
| |
JComboBox hierarchy | |
| |
| |
JComboBox constructors | |
| |
| |
JComboBox significant method groupings | |
| |
| |
| |
Viewing HTML and other content types | |
| |
| |
Listening for hyperlink changes | |
| |
| |
JEditorPane hierarchy | |
| |
| |
JEditorPane constructors | |
| |
| |
JEditorPane significant method groupings | |
| |
| |
| |
Viewing RTF format | |
| |
| |
| |
Simple document processing | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Progress bars, scroll bars, and sliders | |
| |
| |
| |
Progress bars | |
| |
| |
JProgressBar hierarchy | |
| |
| |
JProgressBar variables | |
| |
| |
JProgressBar constructors | |
| |
| |
JProgressBar significant method groupings | |
| |
| |
| |
Scroll bars | |
| |
| |
JScrollBar hierarchy | |
| |
| |
JScrollBar variables | |
| |
| |
JScrollBar constructors | |
| |
| |
JScrollBar significant method groupings | |
| |
| |
| |
Sliders | |
| |
| |
Listening for slider activity | |
| |
| |
JSlider hierarchy | |
| |
| |
JSlider variables | |
| |
| |
JSlider constructors | |
| |
| |
JSlider significant method groupings | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Menus, toolbars, and actions | |
| |
| |
| |
Menu bars | |
| |
| |
Creating application menus | |
| |
| |
JMenuBar hierarchy | |
| |
| |
JMenuBar constructors | |
| |
| |
JMenuBar significant method groupings | |
| |
| |
| |
Menus | |
| |
| |
Creating cascading menus | |
| |
| |
JMenu hierarchy | |
| |
| |
JMenu variables | |
| |
| |
JMenu constructors | |
| |
| |
JMenu significant method groupings | |
| |
| |
| |
Menu items | |
| |
| |
Adding graphics to menu items | |
| |
| |
Adding ToolTips | |
| |
| |
Menu item keyboard mnemonics | |
| |
| |
Responding to a menu selection | |
| |
| |
JMenuItem hierarchy | |
| |
| |
JMenuItem constructors | |
| |
| |
JMenuItem significant method groupings | |
| |
| |
| |
Check box menu items | |
| |
| |
Managing check box state | |
| |
| |
JCheckBoxMenuItem hierarchy | |
| |
| |
JCheckBoxMenuItem variables | |
| |
| |
JCheckBoxMenuItem constructors | |
| |
| |
JCheckBoxMenuItem significant method groupings | |
| |
| |
| |
Radio button menu items | |
| |
| |
JRadioButtonMenuItem hierarchy | |
| |
| |
JRadioButtonMenuItem variables | |
| |
| |
JRadioButtonMenuItem constructors | |
| |
| |
| |
Pop-up menus | |
| |
| |
JPopupMenu hierarchy | |
| |
| |
JPopupMenu constructors | |
| |
| |
JPopupMenu significant method groupings | |
| |
| |
| |
Toolbars | |
| |
| |
Toolbar basics | |
| |
| |
A toolbar with many faces | |
| |
| |
Docking and undocking toolbars | |
| |
| |
Adding other components to a toolbar | |
| |
| |
JToolBar hierarchy | |
| |
| |
JToolBar constructors | |
| |
| |
JToolBar significant method groupings | |
| |
| |
| |
Actions | |
| |
| |
Action basics | |
| |
| |
Common actions for menus and toolbars | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Dialogs and internal frames | |
| |
| |
| |
Simple dialogs | |
| |
| |
Handling the close operation | |
| |
| |
Modal vs. nonmodal dialogs | |
| |
| |
A more advanced JDialog example | |
| |
| |
JDialog hierarchy | |
| |
| |
JDialog variables | |
| |
| |
JDialog constructors | |
| |
| |
JDialog significant method groupings | |
| |
| |
| |
Option dialogs | |
| |
| |
JOptionPane hierarchy | |
| |
| |
JOptionPane constants | |
| |
| |
JOptionPane variables | |
| |
| |
JOptionPane constructors | |
| |
| |
JOptionPane significant method groupings | |
| |
| |
| |
The color chooser | |
| |
| |
The JColorChooser dialog | |
| |
| |
JColorChooser as a component | |
| |
| |
JColorChooser hierarchy | |
| |
| |
JColorChooser constants | |
| |
| |
JColorChooser constructors | |
| |
| |
JcolorChooser significant method groupings | |
| |
| |
| |
The file chooser | |
| |
| |
JFileChooser hierarchy | |
| |
| |
JFileChooser variables | |
| |
| |
JFileChooser constructors | |
| |
| |
JFileChooser significant method groupings | |
| |
| |
| |
Internal frames | |
| |
| |
JInternalFrame hierarchy | |
| |
| |
JInternalFrame constants | |
| |
| |
JInternalFrame variables | |
| |
| |
JInternalFrame constructors | |
| |
| |
JInternalFrame significant method groupings | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
List boxes | |
| |
| |
| |
A simple JList example | |
| |
| |
| |
A more advanced JList example | |
| |
| |
| |
Listening for list activity | |
| |
| |
| |
Custom data model | |
| |
| |
| |
Basic custom list rendering | |
| |
| |
| |
Advanced custom list rendering | |
| |
| |
| |
JList class information | |
| |
| |
JList hierarchy | |
| |
| |
JList constructors | |
| |
| |
JList significant method groupings | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Trees | |
| |
| |
| |
Basic tree implementation | |
| |
| |
A basic JTree example | |
| |
| |
Adding new tree items | |
| |
| |
Custom data models | |
| |
| |
Custom rendering | |
| |
| |
Editing tree nodes | |
| |
| |
| |
Listening for tree actions | |
| |
| |
Listening for tree selections | |
| |
| |
Listening for tree expansions | |
| |
| |
| |
Tips and tricks for enhancing trees | |
| |
| |
Hiding the root node | |
| |
| |
Expanding and collapsing the tree | |
| |
| |
Selecting and deselecting nodes | |
| |
| |
| |
JTree class information | |
| |
| |
JTree hierarchy | |
| |
| |
JTree constants | |
| |
| |
JTree variables | |
| |
| |
JTree constructors | |
| |
| |
JTree significant method groupings | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Tables | |
| |
| |
| |
Basic table use | |
| |
| |
The simplest of table examples | |
| |
| |
A more complex table example | |
| |
| |
| |
Adding a custom data model | |
| |
| |
A simple data model example | |
| |
| |
| |
Adding custom rendering | |
| |
| |
Simple table cell rendering | |
| |
| |
| |
Rendering column headers | |
| |
| |
Simple header rendering | |
| |
| |
| |
Listening for table actions | |
| |
| |
Detecting table selections | |
| |
| |
Detecting column property changes | |
| |
| |
| |
Other tips and tricks | |
| |
| |
Eliminating the annoying gray background | |
| |
| |
Intercepting mouse and keyboard events | |
| |
| |
| |
Putting it all together | |
| |
| |
| |
JTable class information | |
| |
| |
JTable hierarchy | |
| |
| |
JTable constants | |
| |
| |
JTable variables | |
| |
| |
JTable constructors | |
| |
| |
JTable significant method groups | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Advanced topics | |
| |
| |
| |
Creating custom look and feel | |
| |
| |
| |
Model-view-controller architecture revisited | |
| |
| |
| |
Why create a look and feel? | |
| |
| |
Corporate standard user interface | |
| |
| |
Ease of portability | |
| |
| |
New component creation | |
| |
| |
| |
UIManager and JFC look and feel | |
| |
| |
Listing available look-and-feel libraries | |
| |
| |
Changing the current look and feel | |
| |
| |
| |
Creating a look | |
| |
| |
Building a new button | |
| |
| |
Building chrome menus | |
| |
| |
Supporting themes | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Optimizing JFC applications | |
| |
| |
| |
Why optimize? | |
| |
| |
| |
Using optimization tools | |
| |
| |
A poorly performing test case | |
| |
| |
Sun's JDK profiler | |
| |
| |
Profiling with Java WorkShop | |
| |
| |
Profiling with OptimizeIt | |
| |
| |
A custom profiler class | |
| |
| |
Native compilation--the easy way out | |
| |
| |
| |
General rules for Java optimization | |
| |
| |
Loop optimization | |
| |
| |
String handling | |
| |
| |
Numerical data handling | |
| |
| |
Native code | |
| |
| |
Other tips for optimizing Java code | |
| |
| |
| |
Optimizing JFC applications | |
| |
| |
Adding threads to a JFC application | |
| |
| |
Using JFC timers to reduce CPU usage | |
| |
| |
Other tips for optimizing JFC applications | |
| |
| |
| |
Chapter summary | |
| |
| |
| |
Visual development tools | |
| |
| |
| |
Other tools | |
| |
| |
| |
Sources of information | |
| |
| |
| |
References | |
| |
| |
Index | |