search for books and compare prices
Tables of Contents for Java Swing
Chapter/Section Title
Page #
Page Count
Preface
xxi
 
1. Introducing Swing
1
21
What Is Swing?
1
5
What Are the Java Foundation Classes (JFC)?
2
1
Is Swing a Replacement for AWT?
3
2
Rethinking the AWT
5
1
JFC vs. AFC
6
1
Swing Features
6
5
Pluggable Look-and-Feels
7
1
Lightweight Components
7
2
Additional Features
9
1
How Can I Use Swing?
10
1
Swing Packages and Classes
11
4
Swing Packages
11
2
Class Hierarchy
13
2
The Model-View-Controller Architecture
15
3
MVC Interaction
16
1
MVC in Swing
17
1
Working with Swing
18
2
Multithreading
18
1
The Z-Order Caveat: Lightweight and Heavyweight Components
19
1
The Swing Set Demo
20
1
Reading this Book
21
1
2. Jump Starting a Swing Application
22
22
Upgrading Your Programs
22
10
A Simple AWT Application
23
1
Including Your First Swing Component
24
8
Beyond Buttons
32
4
What Is an Internal Frame?
33
3
A Bigger Application
36
8
3. Swing Component Basics
44
37
Understanding Actions
44
7
Actions and Containers
44
1
The Action Interface
45
2
The AbstractAction Class
47
4
Sending Change Events in Swing
51
2
The ChangeEvent Class
52
1
The ChangeListener Interface
52
1
The JComponent Class
53
28
Inherited Properties
54
3
JComponent Properties
57
16
Events
73
2
Fields and Methods
75
6
4. Labels and Icons
81
17
Labels
81
9
The JLabel Class
81
9
Icons
90
8
The Icon Interface
91
3
The ImageIcon Class
94
4
5. Buttons
98
31
Buttons
98
31
The ButtonModel Interface
99
2
The DefaultButtonModel Class
101
2
The AbstractButton Class
103
7
The JButton Class
110
7
The JToggleButton Class
117
3
The JToggleButton.ToggleButtonModel Class
120
1
The JCheckBox Class
121
1
The JRadioButton Class
122
2
The ButtonGroup Class
124
5
6. Bounded Range Components
129
30
The Bounded-Range Model
129
7
The DefaultBoundedRangeModel Class
132
4
The JScrollBar Class
136
5
The JSlider Class
141
6
The JProgressBar Class
147
5
Working with Progress Bars
151
1
Monitoring Progress
152
7
The ProgressMonitor Class
152
3
The ProgressMonitorInputStream
155
4
7. Lists and Combo Boxes
159
50
Lists
159
4
Anatomy of a Swing List
162
1
Where To Go from Here?
163
1
Representing List Data
163
10
The ListModel Interface
164
1
The AbstractListModel Class
164
1
The DefaultListModel Class
165
6
ListDataEvent
171
1
The ListDataListener Interface
172
1
Handling Selections
173
10
The ListSelectionModel Interface
173
2
The DefaultListSelectionModel Class
175
5
ListSelectionEvent
180
1
ListSelectionListener
180
3
Displaying Cell Elements
183
2
The ListCellRenderer Interface
183
2
The DefaultListCellRenderer Class
185
1
The JList Class
185
7
The Java Books Example
191
1
Combo Boxes
192
8
The ComboBoxModel Interface
194
1
The MutableComboBoxModel Interface
194
1
The DefaultComboBoxModel Class
195
2
ComboBoxEditor
197
3
The JComboBox Class
200
9
The Key Selection Manager
201
5
Java Books Revisited
206
3
8. Swing Containers
209
36
A Simple Container
209
22
The JPanel Class
209
3
The Root Pane
212
1
The JRootPane Class
212
11
The RootPaneContainer Interface
223
1
The JLayeredPane Class
223
8
Basic RootPaneContainers
231
14
The WindowConstants Interface
231
1
The JFrame Class
231
5
The JWindow Class
236
4
The JApplet Class
240
5
9. Internal Frames
245
30
Managing a Desktop
245
18
Overview
245
2
The JInternalFrame Class
247
6
The JInternalFrame.JDesktopIcon Class
253
1
The InternalFrameEvent Class
254
1
The InternalFrameListener Interface
255
1
The InternalFrameAdapter Class
256
1
The JDesktopPane Class
257
1
The DesktopManager Interface
258
2
The DefaultDesktopManager Class
260
3
Building a Desktop
263
12
10. Swing Dialogs
275
28
The JDialog Class
275
4
The JOptionPane Class
279
24
11. Specialty Panes and Layout Managers
303
44
The JSplitPane Class
303
6
Minimum and Preferred Sizes
309
1
The JScrollPane Class
309
16
Headers and Corners
315
1
The Scrollable Interface
316
2
ScrollPaneLayout
318
4
JViewport
322
3
The ViewportLayout Class
325
1
The JTabbedPane Class
325
6
Layout Managers
331
15
The Box and BoxLayout Classes
332
1
The Box Class
332
4
The Box.Filler Class
336
1
The BoxLayout Class
337
3
OverlayLayout
340
1
The SizeRequirements Class
341
2
An OverlayLayout Example
343
3
Other Panes
346
1
12. Chooser Dialogs
347
41
The JFileChooser Class
347
14
The File Chooser Package
361
9
The FileFilter Class
361
3
The FileView Class
364
5
The FileSystemView Class
369
1
The Color Chooser
370
4
The ColorSelectionModel Interface
372
1
The DefaultColorSelectionModel Class
373
1
The JColorChooser Class
374
14
The AbstractColorChooserPanel Class
376
1
The ColorChooserComponentFactory Class
377
1
Developing a Custom Chooser Panel
378
3
Custom Preview Panel
381
1
Developing a Custom Dialog
381
7
13. Borders
388
28
Introducing Borders
388
5
The Border Interface
390
1
Painting Borders Correctly
391
1
The AbstractBorder Class
391
2
Swing Borders
393
17
The BevelBorder and SoftBevelBorder Classes
393
5
The Empty Border Class
398
1
The EtchedBorder Class
399
2
The LineBorder Class
401
2
The MatteBorder Class
403
3
The TitledBorder Class
406
4
The CompoundBorder Class
410
3
The BorderFactory Class
411
2
Creating Your Own Border
413
3
14. Menus and Toolbars
416
63
Introducing Swing Menus
416
5
Menu Hierarchy
418
1
Getting Your Feet Wet
419
2
Menu Bar Selection Models
421
3
The SingleSelectionModel Interface
422
1
The DefaultSingleSelectionModel Class
423
1
The JMenuBar Class
424
4
The JMenuItem Class
428
11
Menu Item Shortcuts
429
2
Images
431
1
Event Handling
432
4
The MenuDragMouseEvent Class
436
1
The MenuDragMouseListener Interface
437
1
The MenuKeyEvent Class
437
1
The MenuKeyListener Interface
438
1
The JPopupMenu Class
439
8
Displaying the Popup Menu
440
5
Using Popup Menus
445
2
The PopupMenuEvent Class
447
1
The PopupMenuListener Class
447
1
The JMenu Class
447
9
The MenuEvent Class
455
1
The MenuListener Interface
456
1
Selectable Menu Items
456
14
The JCheckBoxMenuItem Class
456
4
The JRadioButtonMenuItem Class
460
4
The JSeparator Class
464
2
The MenuElement Interface
466
4
Toolbars
470
9
The JToolBar Class
470
9
15. Tables
479
59
Table Columns
480
12
The TableColumn Class
481
3
The TableColumnModel Interface
484
2
The DefaultTableColumnModel Class
486
3
The TableColumnModelEvent Class
489
1
The TableColumnModelListener Interface
489
1
Implementing A Column Model
490
2
Table Data
492
19
The TableModel Interface
492
1
The AbstractTableModel Class
493
3
The TableModelEvent Class
496
2
The TableModelListener Interface
498
1
The DefaultTableModel Class
498
3
Dynamic Table Data
501
6
Database Data
507
4
The JTable Class
511
14
The JTableHeader Class
522
3
Editing and Rendering
525
8
The TableCellRenderer Interface
525
1
The DefaultTableCellRenderer Class
525
6
The TableCellEditor Interface
531
2
Selecting Table Entries
533
5
16. Advanced Table Examples
538
22
A Table with Row Headers
538
5
Large Tables with Paging
543
6
Charting Data with a TableModel
549
11
17. Trees
560
79
A Simple Tree
561
4
Tree Terminology
563
2
Tree Models
565
12
The TreeModel Interface
565
2
The DefaultTreeModel Class
567
4
Working with Tree Models
571
6
Tree Nodes and Paths
577
12
The TreeNode Interface
577
1
The MutableTreeNode Interface
578
1
The DefaultMutableTreeNode Class
579
8
The TreePath Class
587
2
The JTree Class
589
15
Tree Selections
604
4
The RowMapper Interface
605
1
The TreeSelectionModel Interface
605
2
The DefaultTreeSelectionModel Class
607
3
Tree Events
610
8
The TreeModelEvent Class
610
1
The TreeModelListener Interface
611
3
The TreeSelectionEvent Class
614
1
The TreeSelectionListener Interface
615
1
The TreeExpansionEvent Class
615
1
The TreeExpansionListener Interface
616
1
Pending Expansion Events
616
1
Implementing the Expansion Listener Interface
617
1
Rendering and Editing
618
20
Rendering Nodes
619
3
The DefaultTreeCellRenderer Class
622
2
Custom Renderers
624
1
The TreeCellRenderer Interface
624
2
Editing Nodes
626
1
The TreeCellEditor Interface
627
1
The DefaultTreeCellEditor Class
627
11
Look-and-Feel Helper Classes
638
1
What Next?
638
1
18. Undo
639
52
The Swing Undo Facility
640
51
The UndoableEdit Interface
641
4
The AbstractUndoableEdit Class
645
6
The CompoundEdit Class
651
6
The UndoableEditEvent Class
657
1
The UndoableEditListener Interface
658
1
The UndoManager Class
658
17
The StateEditable Interface
675
1
The StateEdit Class
675
8
The UndoableEditSupport Class
683
4
The CannotRedoException Class
687
1
The CannotUndoException Class
687
1
Extending UndoManager
687
4
19. Text 101
691
38
The Swing Text Components
692
36
The JTextComponent Class
693
7
The JTextComponent.KeyBinding Class
700
1
The JTextField Class
700
11
The JPasswordField Class
711
1
The JTextArea Class
712
8
The JEditorPane Class
720
4
The HyperlinkListener Interface
724
1
The HyperlinkEvent Class
724
1
The JTextPane Class
725
3
More to Come
728
1
20. Document Model and Events
729
59
The Document Model
729
45
The Document Interface
730
3
The Element Interface
733
3
The ElementIterator Class
736
1
The AttributeSet Interface
737
2
The MutableAttributeSet Interface
739
1
The SimpleAttributeSet Class
740
4
The Position Interface
744
2
The Position.Bias Class
746
1
The Segment Class
746
1
The AbstractDocument Class
747
9
The AbstractDocument.AbstractElement Class
756
3
The AbstractDocument.LeafElement Class
759
1
The AbstractDocument.BranchElement Class
760
2
The AbstractDocument.Content Interface
762
1
The StringContent Class
762
2
The GapContent Class
764
2
The AbstractDocument.AttributeContext Interface
766
1
The BadLocationException Class
767
1
Model Summary So Far
767
1
The PlainDocument Class
768
6
Document Events
774
8
The DocumentEvent Interface
774
1
The DocumentEvent.EventType Class
775
1
The DocumentEvent.ElementChange Interface
776
1
The DocumentListener Interface
777
1
Document and Undo Event Example
778
4
Advanced AbstractDocument Event Model
782
6
The AbstractDocument.ElementEdit Class
783
1
The AbstractDocument.DefaultDocumentEvent Class
784
4
21. Styled Documents and JTextPane
788
57
Style
788
43
The Style Interface
791
1
The StyleConstants Class
792
5
The TabStop Class
797
4
The TabSet Class
801
1
The StyleContext Class
801
8
The StyledContext.NamedStyle Class
809
3
The StyledDocument Interface
812
2
The DefaultStyledDocument Class
814
8
The DefaultStyledDocument.SectionElement Class
822
1
The DefaultStyledDocument.ElementSpec Class
822
2
The DefaultStyledDocument.ElementBuffer Class
824
2
The JTextPane Class
826
5
A Stylized Editor
831
14
22. Carets, Highlighters, and Keymaps
845
22
JTextComponent UI Properties
845
22
The Caret Interface
846
2
The DefaultCaret Class
848
7
The CaretListener Interface
855
1
The CaretEvent Class
855
1
The Highlighter Interface
856
1
The Highlighter.Highlight Interface
857
1
The Highlighter.HighlightPainter Interface
858
1
The DefaultHighlighter Class
858
1
The DefaultHighlighter.DefaultHighlightPainter Class
859
3
The Keymap Interface
862
5
23. Text Views
867
45
Text Views
867
7
A Few Notes
869
1
Overview of the View Classes
869
5
The View Classes
874
38
The View Class
874
5
The ViewFactory Interface
879
1
The TabExpander Interface
879
1
The TabableView Interface
880
1
The Utilities Class
880
1
The PlainView Class
881
4
The FieldView Class
885
1
The PasswordView Class
886
1
The LabelView Class
887
4
The ComponentView Class
891
1
The IconView Class
892
1
The CompositeView Class
893
3
The BoxView Class
896
4
The ParagraphView Class
900
4
The WrappedPlainView Class
904
3
The TableView Class
907
2
The TableView.TableRow Class
909
1
The TableView.TableCell Class
910
2
24. EditorKits and TextActions
912
47
Overview of the Editor Kits
912
46
The EditorKit Class
912
4
The TextAction Class
916
1
The DefaultEditorKit Class
917
5
The DefaultEditorKit.DefaultKeyTypedAction Class
922
1
The DefaultEditorKit.BeepAction Class
922
1
The DefaultEditorKit.CopyAction Class
923
1
The DefaultEditorKit.CutAction Class
923
1
The DefaultEditorKit.InsertBreakAction Class
923
1
The DefaultEditorKit.InsertContentAction Class
923
1
The DefaultEditorKit.InsertTabAction Class
924
1
The DefaultEditorKit.PasteAction Class
924
1
A Simple Text Editor
924
7
The StyledEditorKit Class
931
2
The StyledEditorKit.StyledTextAction Class
933
1
The StyledEditorKit.FontFamilyAction Class
934
1
The StyledEditorKit.FontSizeAction Class
935
1
The StyledEditorKit.ForegroundAction Class
935
1
The StyledEditorKit.AlignmentAction Class
936
1
The StyledEditorKit.BoldAction Class
936
1
The StyledEditorKit.ItalicAction Class
936
1
The StyledEditorKit.UnderlineAction Class
937
1
A Better Editor
937
6
The HTML Package
943
6
Much, Much More
949
1
RTFEditorKit
949
2
The AbstractWriter Class
951
3
Building Your Own EditorKit
954
4
Phew!
958
1
25. Programming with Accessibility
959
39
How Accessibility Works
960
3
The Accessibility Contract
962
1
How Do I Get It?
962
1
The Accessibility Package
963
6
The Path to Determining Accessibility
963
1
The Accessible Interface
964
1
The AccessibleContext Class
965
4
Other Accessible Objects
969
4
AccessibleState
969
1
AccessibleStateSet
970
1
AccessibleRole
971
2
The Six Types of Accessibility
973
11
The AccessibleAction Interface
974
1
The AccessibleComponent Interface
974
2
The AccessibleSelection Interface
976
1
The AccessibleText Interface
977
2
The AccessibleHypertext Interface
979
1
The AccessibleHyperlink Class
980
1
The AccessibleValue Interface
981
1
Implementing AccessibleAction
981
3
The Accessibility Utility Classes
984
8
The EventQueueMonitor Class
985
2
The AWTEventMonitor Class
987
2
The SwingEventMonitor Class
989
2
The TopLevelWindowListener Interface
991
1
The GUIInitializedListener Interface
991
1
Interfacing with Accessibility
992
6
26. Look & Feel
998
66
How Does It Work?
999
3
Key L&F Classes and Interfaces
1002
21
The LookAndFeel Class
1003
4
The UIDefaults Class
1007
2
The UIDefaults.ActiveValue Interface
1009
1
The UIDefaults.LazyValue Interface
1010
1
The UIResource Interface
1011
3
The UIManager Class
1014
7
The UIManager.LookAndFeelInfo Class
1021
1
The ComponentUI Class
1022
1
The MultiLookAndFeel
1023
6
Look-and-Feel Customization
1029
13
Modification of Component Properties
1030
1
Modification of the UI Defaults
1030
2
Use of Metal's Themes
1032
5
Use of Metal's Client Properties
1037
1
Replacement of Individual UI Delegates
1038
4
Creation of a Custom L&F
1042
22
The PlainLookAndFeel
1043
1
Creating the LookAndFeel Class
1043
7
Defining an Icon Factory
1050
3
Defining Custom Borders
1053
2
The BasicGraphicsUtils Class
1055
1
Create the Individual UI Delegates
1056
6
Don't Forget to Use It
1062
1
How's It Look?
1062
1
One Down
1062
2
27. Swing Utilities
1064
30
General Utilities
1065
11
The SwingUtilities Class
1065
4
The SwingConstants Interface
1069
1
The Timer Class
1070
3
The ToolTipManager Class
1073
2
The JToolTip Class
1075
1
Editing and Rendering Utilities
1076
5
The CellRendererPane Class
1076
1
The CellEditor Interface
1077
2
The CellEditorListener Interface
1079
1
The DefaultCellEditor Class
1079
2
Event Utilities
1081
11
The EventListenerList Class
1081
4
The KeyStroke Class
1085
5
The MouseInputAdapter Class
1090
2
Image Utilities
1092
2
The GrayFilter Class
1092
1
The Renderer Interface
1092
2
28. Swing Under the Hood
1094
53
Creating Your Own Component
1094
23
Creating the Component
1095
1
Creating a Model
1096
7
The UI Delegate
1103
1
Creating the Component Itself
1104
2
Some Final Questions
1106
2
The Jog Shuttle: A Simple Swing Component
1108
7
A Toy Using the Shuttle
1115
2
Working with Focus
1117
12
The FocusManager Class
1122
2
The DefaultFocusManager Class
1124
5
Lightweight vs. Heavyweight Components
1129
5
Understanding the Z-Order
1130
1
Mixing Swing and AWT
1130
4
Multithreading Issues with Swing
1134
7
When Is Thread Safety an Issue?
1135
1
Updating Components in the Event Dispatch Thread
1136
5
Painting and Repainting
1141
6
Swing Responsibilities
1141
1
The RepaintManager Class
1142
5
A. Look & Feel Resources
1147
10
Index
1157