Java Swing

Robert Eckstein, Marc Loy, Dave Wood

Publisher: O'Reilly, 1998, 1227 pages

ISBN: 1-56592-455-X

Keywords: Java

Last modified: May 31, 2021, 6:17 p.m.

Swing, the centerpiece of the JFC (Java Foundation Classes), eliminates Java's biggest weakness: it's relative primitive user interface toolkit. Swing provides many new components that allow you to build sophisticated user interfaces easily. The old components have been greatly improved, and there are added components such as internal frames, trees, tables, and text editors. These Swing components provide more uniform cross-platform behavior than the older AWT components, bringing the goal of "write once, run anywhere" closer to reality.

All these new features mean that there's a lot to learn. Swing is undoubtedly way ahead of AWT — or, for that matter, any widely available user interface toolkit — but it's also a lot more complicated. It's still easy to do simple things, but once you've seen what's possible, you won't want to limit yourself to doing the simple things.

Java Swing gives you in-depth coverage of everything you need to know to take full advantage of Swing, providing detailed descriptions of every class and interface in the key Swing packages. It covers Swing 1.1 for use with both JDK 1.2 and 1.1, providing detailed decriptions of every class and interface in the key Swing packages. It shows you how to use all of the new components, allowing you to build state-of-the-art user interfaces. It also discusses how the components implement the MVC (Model View Controller) architecture, so you can understand how the components are designed, subclass them intelligently, and design your own when necessary. You'll find many substantive examples that can support thousands of rows efficiently. Finally, it covers advanced features, like creating your own "look and feel" using the accessibility API. Throughout, Java Swing focuses on giving you the context you need to understand what you're doing. It's more than documentation; Java Swing is full of examples and detailed explanations that help you develop code quickly and effectively.

Whether you're a serious Java developer, or just trying to find out what Java can do, you'll find Java Swing an indispensable guide.

  1. Introducing Swing
    • What Is Swing?
      • What Are the Java Foundation Classes (JFC)?
      • Is Swing a Replacement for AWT?
      • Rethinking the AWT
      • JFC vs. AFC
    • Swing Features
      • Pluggable Look-and-Feels
      • Lightweight Components
      • Additional Features
      • How Can I Use Swing?
    • Swing Packages and Classes
      • Swing Packages
      • Class Hierarchy
    • The Model-View-Controller Architecture
      • MVC Interaction
      • MVC in Swing
    • Working with Swing
      • Multithreading
      • The Z-Order Caveat: Lightweight and Heavyweight Components
    • The Swing Set Demo
    • Reading this Book
  2. Jump Starting a Swing Application
    • Upgrading Your Programs
      • A Simple AWT Application
      • Including Your First Swing Component
    • Beyond Buttons
      • What Is an Internal Frame?
    • A Bigger Application
  3. Swing Component Basics
    • Understanding Actions
      • Actions and Containers
      • The Action Interface
      • The AbstractAction Class
    • Sending Change Events in Swing
      • The ChangeEvent Class
      • The ChangeListener Interface
    • The JComponent Class
      • Inherited Properties
      • JComponent Properties
      • Events
      • Fields and Methods
  4. Labels and Icons
    • Labels
      • The JLabel Class
    • Icons
      • The Icon Interface
      • The ImageIcon Class
  5. Buttons
    • Buttons
      • The ButtonModel Interface
      • The DefaultButtonModel Class
      • The AbstractButton Class
      • The JButton Class
      • The JToggleButton Class
      • The JToggleButton.ToggleButtonModel Class
      • The JCheckBox Class
      • The JRadioButton Class
      • The ButtonGroup Class
  6. Bounded Range Components
    • The Bounded-Range Model
      • The DefaultBoundedRangeModel Class
    • The JScrollBar Class
    • The JSlider Class
    • The JProgressBar Class
      • Working with Progress Bars
    • Monitoring Progress
      • The ProgressMonitor Class
      • The ProgressMonitorInputStream
  7. Lists and Combo Boxes
    • Lists
      • Anatomy of a Swing List
      • Where To Go from Here?
    • Representing List Data
      • The ListModel Interface
      • The AbstractListModel Class
      • The DefaultListModel Class
      • ListDataEvent
      • The ListDataListener Interface
    • Handling Selections
      • The ListSelectionModel Interface
      • The DefaultListSelectionModel Class
      • ListSelectionEvent
      • ListSelectionListener
    • Displaying Cell Elements
      • The ListCellRenderer Interface
      • The DefaultListCellRenderer Class
    • The JList Class
      • The Java Books Example
    • Combo Boxes
      • The ComboBoxModel Interface
      • The MutableComboBoxModel Interface
      • The DefaultComboBoxModel Class
      • ComboBoxEditor
    • The JComboBox Class
    • ul>
    • The Key Selection Manager
    • Java Books Revisited
  8. Swing Containers
    • A Simple Container
      • The JPanel Class
      • The Root Pane
      • The JRootPane Class
      • The RootPaneContainer Interface
      • The JLayeredPane Class
    • Basic RootPaneContainers
      • The WindowConstants Interface
      • The JFrame Class
      • The JWindow Class
      • The JApplet Class
  9. Internal Frames
    • Managing a Desktop
      • Overview
      • The JInternalFrame Class
      • The JInternalFrame.JDesktopIcon Class
      • The InternalFrameEvent Class
      • The InternalFrameListener Interface
      • The InternalFrameAdapter Class
      • The JDesktopPane Class
      • The DesktopManager Interface
      • The DefaultDesktopManager Class
    • Building a Desktop
  10. Swing Dialogs
    • The JDialog Class
    • The JOptionPane Class
  11. Specialty Panes and Layout Managers
    • The JSplitPane Class
      • Minimum and Preferred Sizes
    • The JScrollPane Class
      • Headers and Corners
      • The Scrollable Interface
      • ScrollPaneLayout
      • JViewport
      • The ViewportLayout Class
    • The JTabbedPane Class
    • Layout Managers
      • The Box and BoxLayout Classes
      • The Box Class
      • The Box.Filler Class
      • The BoxLayout Class
      • OverlayLayout
      • The SizeRequirements Class
      • An OverlayLayout Example
    • Other Panes
  12. Chooser Dialogs
    • The JFileChooser Class
    • The File Chooser Package
      • The FileFilter Class
      • The FileView Class
      • The FileSystemView Class
    • The Color Chooser
      • The ColorSelectionModel Interface
      • The DefaultColorSelectionModel Class
    • The JColorChooser Class
      • The AbstractColorChooserPanel Class
      • The ColorChooserComponentFactory Class
      • Developing a Custom Chooser Panel
      • Custom Preview Panel
      • Developing a Custom Dialog
  13. Borders
    • Introducing Borders
      • The Border Interface
      • Painting Borders Correctly
      • The AbstractBorder Class
    • Swing Borders
      • The BevelBorder and SoftBevelBorder Classes
      • The Empty Border Class
      • The EtchedBorder Class
      • The LineBorder Class
      • The MatteBorder Class
      • The TitledBorder Class
    • The CompoundBorder Class
      • The BorderFactory Class
  14. Menus and Toolbars
    • Introducing Swing Menus
      • Menu Hierarchy
      • Getting Your Feet Wet
    • Menu Bar Selection Models
      • The SingleSelectionModel Interface
      • The DefaultSingleSelectionModel Class
    • The JMenuBar Class
    • The JMenuItem Class
      • Menu Item Shortcuts
      • Images
      • Event Handling
      • The MenuDragMouseEvent Class
      • The MenuDragMouseListener Interface
      • The MenuKeyEvent Class
      • The MenuKeyListener Interface
    • The JPopupMenu Class
      • Displaying the Popup Menu
      • Using Popup Menus
      • The PopupMenuEvent Class
      • The PopupMenuListener Class
    • The JMenu Class
      • The MenuEvent Class
      • The MenuListener Interface
    • Selectable Menu Items
      • The JCheckBoxMenuItem Class
      • The JRadioButtonMenuItem Class
      • The JSeparator Class
      • The MenuElement Interface
    • Toolbars
      • The JToolBar Class
  15. Tables
    • Table Columns
      • The TableColumn Class
      • The TableColumnModel Interface
      • The DefaultTableColumnModel Class
      • The TableColumnModelEvent Class
      • The TableColumnModelListener Interface
      • Implementing A Column Model
    • Table Data
      • The TableModel Interface
      • The AbstractTableModel Class
      • The TableModelEvent Class
      • The TableModelListener Interface
      • The DefaultTableModel Class
      • Dynamic Table Data
      • Database Data
    • The JTable Class
      • The JTableHeader Class
    • Editing and Rendering
      • The TableCellRenderer Interface
      • The DefaultTableCellRenderer Class
      • The TableCellEditor Interface
    • Selecting Table Entries
  16. Advanced Table Examples
    • A Table with Row Headers
    • Large Tables with Paging
    • Charting Data with a TableModel
  17. Trees
    • A Simple Tree
      • Tree Terminology
    • Tree Models
      • The TreeModel Interface
      • The DefaultTreeModel Class
      • Working with Tree Models
    • Tree Nodes and Paths
      • The TreeNode Interface
      • The MutableTreeNode Interface
      • The DefaultMutableTreeNode Class
      • The TreePath Class
    • The JTree Class
    • Tree Selections
      • The RowMapper Interface
      • The TreeSelectionModel Interface
      • The DefaultTreeSelectionModel Class
    • Tree Events
      • The TreeModelEvent Class
      • The TreeModelListener Interface
      • The TreeSelectionEvent Class
      • The TreeSelectionListener Interface
      • The TreeExpansionEvent Class
      • The TreeExpansionListener Interface
      • Pending Expansion Events
      • Implementing the Expansion Listener Interface
    • Rendering and Editing
      • Rendering Nodes
      • The DefaultTreeCellRenderer Class
      • Custom Renderers
      • The TreeCellRenderer Interface
      • Editing Nodes
      • The TreeCellEditor Interface
      • The DefaultTreeCellEditor Class
      • Look-and-Feel Helper Classes
    • What Next?
  18. Undo
    • The Swing Undo Facility
      • The UndoableEdit Interface
      • The AbstractUndoableEdit Class
      • The CompoundEdit Class
      • The UndoableEditEvent Class
      • The UndoableEditListener Interface
      • The UndoManager Class
      • The StateEditable Interface
      • The StateEdit Class
      • The UndoableEditSupport Class
      • The CannotRedoException Class
      • The CannotUndoException Class
      • Extending UndoManager
  19. Text 101
    • The Swing Text Components
      • The JTextComponent Class
      • The JTextComponent.KeyBinding Class
      • The JTextField Class
      • The JPasswordField Class
      • The JTextArea Class
      • The JEditorPane Class
      • The HyperlinkListener Interface
      • The HyperlinkEvent Class
      • The JTextPane Class
    • More to Come
  20. Document Model and Events
    • The Document Model
      • The Document Interface
      • The Element Interface
      • The ElementIterator Class
      • The AttributeSet Interface
      • The MutableAttributeSet Interface
      • The SimpleAttributeSet Class
      • The Position Interface
      • The Position.Bias Class
      • The Segment Class
      • The AbstractDocument Class
      • The AbstractDocument.AbstractElement Class
      • The AbstractDocument.LeafElement Class
      • The AbstractDocument.BranchElement Class
      • The AbstractDocument.Content Interface
      • The StringContent Class
      • The GapContent Class
      • The AbstractDocument.AttributeContext Interface
      • The BadLocationException Class
      • Model Summary So Far
      • The PlainDocument Class
    • Document Events
      • The DocumentEvent Interface
      • The DocumentEvent.EventType Class
      • The DocumentEvent.ElementChange Interface
      • The DocumentListener Interface
      • Document and Undo Event Example
    • Advanced AbstractDocument Event Model
      • The AbstractDocument.ElementEdit Class
      • The AbstractDocument.DefaultDocumentEvent Class
  21. Styled Documents and JTextPane
    • Style
      • The Style Interface
      • The StyleConstants Class
      • The TabStop Class
      • The TabSet Class
      • The StyleContext Class
      • The StyledContext.NamedStyle Class
      • The StyledDocument Interface
      • The DefaultStyledDocument Class
      • The DefaultStyledDocument.SectionElement Class
      • The DefaultStyledDocument.ElementSpec Class
      • The DefaultStyledDocument.ElementBuffer Class
      • The JTextPane Class
    • A Stylized Editor
  22. Carets, Highlighters, and Keymaps
    • JTextComponent UI Properties
      • The Caret Interface
      • The DefaultCaret Class
      • The CaretListener Interface
      • The CaretEvent Class
      • The Highlighter Interface
      • The Highlighter.Highlight Interface
      • The Highlighter.HighlightPainter Interface
      • The DefaultHighlighter Class
      • The DefaultHighlighter.DefaultHighlightPainter Class
      • The Keymap Interface
  23. Text Views
    • Text Views
      • A Few Notes
      • Overview of the View Classes
    • The View Classes
      • The View Class
      • The ViewFactory Interface
      • The TabExpander Interface
      • The TabableView Interface
      • The Utilities Class
      • The PlainView Class
      • The FieldView Class
      • The PasswordView Class
      • The LabelView Class
      • The ComponentView Class
      • The IconView Class
      • The CompositeView Class
      • The BoxView Class
      • The ParagraphView Class
      • The WrappedPlainView Class
      • The TableView Class
      • The TableView.TableRow Class
      • The TableView.TableCell Class
  24. EditorKits and TextActions
    • Overview of the Editor Kits
      • The EditorKit Class
      • The TextAction Class
      • The DefaultEditorKit Class
      • The DefaultEditorKit.DefaultKeyTypedAction Class
      • The DefaultEditorKit.BeepAction Class
      • The DefaultEditorKit.CopyAction Class
      • The DefaultEditorKit.CutAction Class
      • The DefaultEditorKit.InsertBreakAction Class
      • The DefaultEditorKit.InsertContentAction Class
      • The DefaultEditorKit.InsertTabAction Class
      • The DefaultEditorKit.PasteAction Class
      • A Simple Text Editor
      • The StyledEditorKit Class
      • The StyledEditorKit.StyledTextAction Class
      • The StyledEditorKit.FontFamilyAction Class
      • The StyledEditorKit.FontSizeAction Class
      • The StyledEditorKit.ForegroundAction Class
      • The StyledEditorKit.AlignmentAction Class
      • The StyledEditorKit.BoldAction Class
      • The StyledEditorKit.ItalicAction Class
      • The StyledEditorKit.UnderlineAction Class
      • A Better Editor
      • The HTML Package
      • Much, Much More
      • RTFEditorKit
      • The AbstractWriter Class
      • Building Your Own EditorKit
    • Phew!
  25. Programming with Accessibility
    • How Accessibility Works
      • The Accessibility Contract
      • How Do I Get It?
    • The Accessibility Package
      • The Path to Determining Accessibility
      • The Accessible Interface
      • The AccessibleContext Class
    • Other Accessible Objects
      • AccessibleState
      • AccessibleStateSet
      • AccessibleRole
    • The Six Types of Accessibility
      • The AccessibleAction Interface
      • The AccessibleComponent Interface
      • The AccessibleSelection Interface
      • The AccessibleText Interface
      • The AccessibleHypertext Interface
      • The AccessibleHyperlink Class
      • The AccessibleValue Interface
      • Implementing AccessibleAction
    • The Accessibility Utility Classes
      • The EventQueueMonitor Class
      • The AWTEventMonitor Class
      • The SwingEventMonitor Class
      • The TopLevelWindowListener Interface
      • The GUIInitializedListener Interface
    • Interfacing with Accessibility
  26. Look & Feel
    • How Does It Work?
    • Key L&F Classes and Interfaces
      • The LookAndFeel Class
      • The UIDefaults Class
      • The UIDefaults.ActiveValue Interface
      • The UIDefaults.LazyValue Interface
      • The UIResource Interface
      • The UIManager Class
      • The UIManager.LookAndFeelInfo Class
      • The ComponentUI Class
    • The MultiLookAndFeel
    • Look-and-Feel Customization
      • Modification of Component Properties
      • Modification of the UI Defaults
      • Use of Metal’s Themes
      • Use of Metal’s Client Properties
      • Replacement of Individual UI Delegates
    • Creation of a Custom L&F
      • The PlainLookAndFeel
      • Creating the LookAndFeel Class
      • Defining an Icon Factory
      • Defining Custom Borders
      • The BasicGraphicsUtils Class
      • Create the Individual UI Delegates
      • Don’t Forget to Use It
      • How’s It Look?
      • One Down…
  27. Swing Utilities
    • General Utilities
      • The SwingUtilities Class
      • The SwingConstants Interface
      • The Timer Class
      • The ToolTipManager Class
      • The JToolTip Class
    • Editing and Rendering Utilities
      • The CellRendererPane Class
      • The CellEditor Interface
      • The CellEditorListener Interface
      • The DefaultCellEditor Class
    • Event Utilities
      • The EventListenerList Class
      • The KeyStroke Class
      • The MouseInputAdapter Class
    • Image Utilities
      • The GrayFilter Class
      • The Renderer Interface
  28. Swing Under the Hood
    • Creating Your Own Component
      • Creating the Component
      • Creating a Model
      • The UI Delegate
      • Creating the Component Itself
      • Some Final Questions
      • The Jog Shuttle: A Simple Swing Component
      • A Toy Using the Shuttle
    • Working with Focus
      • The FocusManager Class
      • The DefaultFocusManager Class
    • Lightweight vs. Heavyweight Components
      • Understanding the Z-Order
      • Mixing Swing and AWT
    • Multithreading Issues with Swing
      • When Is Thread Safety an Issue?
      • Updating Components in the Event Dispatch Thread
    • Painting and Repainting
      • Swing Responsibilities
      • The RepaintManager Class
  1. Look & Feel Resources

Reviews

Java™ Swing

Reviewed by Roland Buresund

Mediocre **** (4 out of 10)

Last modified: May 21, 2007, 3:09 a.m.

Can't say that I'm overly happy with this, but on the other hand, I'm not happy with Swing as it is.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required