Synopses & Reviews
Swing is a fully-featured user interface development kit for Java applications. Building on the foundations of the Abstract Window Toolkit (AWT), Swing enables cross-platform applications to use any of several pluggable look-and-feels. Swing developers can take advantage of its rich, flexible features and modular components, building elegant user interfaces with very little code.This second edition of Java Swing thoroughly covers all the features available in Java 2 SDK 1.3 and 1.4. More than simply a reference, this new edition takes a practical approach. It is a book by developers for developers, with hundreds of useful examples, from beginning level to advanced, covering every component available in Swing.All these features mean that there's a lot to learn. Even setting aside its platform flexibility, Swing compares favorably with any widely available user interface toolkit--it has great depth. Swing makes it easy to do simple things but is powerful enough to create complex, intricate interfaces.Java Swing, 2nd edition includes :
- A new chapter on Drag and Drop
- Accessibility features for creating a user interface meeting the needs of all users
- Coverage of the improved key binding infrastructure introduced in SDK 1.3
- A new chapter on JFormattedTextField and input validation
- Mac OS X coverage and examples
- Coverage of the improved focus system introduced in SDK 1.4
- Pluggable Look-and-Feel coverage
- Coverage of the new layout manager, SpringLayout, from SDK 1.4
- Properties tables that summarize important features of each component
- Coverage of the 1.4 Spinner component
- Details about using HTML in components
- A new appendix listing bound actions for each component
- A supporting web site with utilities, examples, and supplemental materials
Whether you're a seasoned Java developer or just trying to find out what Java can do, you'll find
Java Swing, 2nd edition an indispensable guide.
Synopsis
Swing is a fully-featured user interface development kit for Java applications. Building on the foundations of the Abstract Window Toolkit (AWT), Swing enables cross-platform applications to use any of several pluggable look-and-feels. Swing developers can take advantage of its rich, flexible features and modular components, building elegant user interfaces with very little code.
This second edition of Java Swing thoroughly covers all the features available in Java 2 SDK 1.3 and 1.4. More than simply a reference, this new edition takes a practical approach. It is a book by developers for developers, with hundreds of useful examples, from beginning level to advanced, covering every component available in Swing.
All these features mean that there's a lot to learn. Even setting aside its platform flexibility, Swing compares favorably with any widely available user interface toolkit it has great depth. Swing makes it easy to do simple things but is powerful enough to create complex, intricate interfaces.
Java Swing, 2nd edition includes :
- A new chapter on Drag and Drop
- Accessibility features for creating a user interface meeting the needs of all users
- Coverage of the improved key binding infrastructure introduced in SDK 1.3
- A new chapter on JFormattedTextField and input validation
- Mac OS X coverage and examples
- Coverage of the improved focus system introduced in SDK 1.4
- Pluggable Look-and-Feel coverage
- Coverage of the new layout manager, SpringLayout, from SDK 1.4
- Properties tables that summarize important features of each component
- Coverage of the 1.4 Spinner component
- Details about using HTML in components
- A new appendix listing bound actions for each component
- A supporting web site with utilities, examples, and supplemental materials
Whether you're a seasoned Java developer or just trying to find out what Java can do, you'll find
Java Swing, 2nd edition an indispensable guide.
About the Author
Marc Loy is a senior programmer at Galileo Systems, LLC, but his day job seems to be teaching Java and Perl to various companies -- including Sun Microsystems. He has played with Java since the alpha days and can't find his way back to C. He is developing an interactive learning application at Galileo written entirely in Java. He received his master's degree in computer science at the University of Wisconsin-Madison, and still lives in Madison with his partner, Ron Becker. He does find time to relax by playing the piano and/or throwing darts, depending on how successful the day of teaching or programming was.
Robert Eckstein, an editor at O'Reilly, works mostly on Java books (notably Java Swing) and is also responsible for the XML Pocket Reference and Webmaster in a Nutshell, 2nd Edition. In his spare time he has been known to provide online coverage for popular conferences. He also writes articles for JavaWorld magazine. Robert holds bachelor's degrees in computer science and communications from Trinity University. In the past, he has worked for the USAA insurance company and more recently spent four years with Motorola's cellular software division. He is the co-author of Using Samba.
David Wood is Technical Director of Plugged In Software in Brisbane, Australia, where he works with a wonderful team producing Java custom software. In his eclectic career he has been a ship's navigator, deep sea salvage engineer, and aerospace project manager for the U.S. Navy, and consulted to Lawrence Livermore National Laboratory and Netscape. David enjoys hiking and sailing with his very patient wife and teaching his son Perl before he goes to kindergarten. David holds degrees in mechanical, electrical, aeronautical, and astronautical engineering from the U.S. Naval Postgraduate School and the Virginia Military Institute.
a senior software engineer at Berbee, with over ten years professional experience as a systems developer. He started designing with objects well before work environments made it convenient, and has a passion for building high-quality Java tools and frameworks to simplify the tasks of other developers.
has been working with Java since its early days and teaches the language at venues ranging from Sun Microsystems to public high school. He has a BA from Oberlin College and an M.S. from the University of Wisconsin-Madison.
Table of Contents
Preface; What This Book Covers; What's New in This Edition?; On the Web Site; Conventions; How to Contact Us; Acknowledgments; Chapter 1: Introducing Swing; 1.1 What Is Swing?; 1.2 Swing Features; 1.3 Swing Packages and Classes; 1.4 The Model-View-Controller Architecture; 1.5 Working with Swing; 1.6 The Swing Set Demo; 1.7 Reading This Book; Chapter 2: Jump-Starting a Swing Application; 2.1 Upgrading Your AWT Programs; 2.2 A Simple AWT Application; 2.3 Including Your First Swing Component; 2.4 Beyond Buttons; 2.5 What Is an Internal Frame?; 2.6 A Bigger Application; Chapter 3: Swing Component Basics; 3.1 Understanding Actions; 3.2 Graphical Interface Events; 3.3 Graphics Environments; 3.4 Sending Change Events in Swing; 3.5 The JComponent Class; 3.6 Responding to Keyboard Input; Chapter 4: Labels and Icons; 4.1 Labels; 4.2 Working with Images; 4.3 Support for HTML; 4.4 Icons; 4.5 Implementing Your Own Icons; 4.6 Dynamic Icons; 4.7 The ImageIcon Class; Chapter 5: Buttons; 5.1 The ButtonModel Interface; 5.2 The DefaultButtonModel Class; 5.3 The AbstractButton Class; 5.4 The JButton Class; 5.5 The JToggleButton Class; 5.6 The JToggleButton.ToggleButtonModel Class; 5.7 The JCheckBox Class; 5.8 The JRadioButton Class; 5.9 The ButtonGroup Class; Chapter 6: Bounded-Range Components; 6.1 The Bounded-Range Model; 6.2 The JScrollBar Class; 6.3 The JSlider Class; 6.4 The JProgressBar Class; 6.5 Monitoring Progress; Chapter 7: Lists, Combo Boxes, and Spinners; 7.1 Lists; 7.2 Representing List Data; 7.3 Handling Selections; 7.4 Displaying Cell Elements; 7.5 The JList Class; 7.6 Combo Boxes; 7.7 The JComboBox Class; 7.8 Spinners; 7.9 Spinner Models; 7.10 Spinner Editors; Chapter 8: Swing Containers; 8.1 A Simple Container; 8.2 The Root Pane; 8.3 Basic RootPaneContainers; 8.4 The JFrame Class; 8.5 The JWindow Class; 8.6 The JApplet Class; Chapter 9: Internal Frames; 9.1 Simulating a Desktop; 9.2 The JInternalFrame Class; 9.3 The JDesktopPane Class; 9.4 The DesktopManager Interface; 9.5 Building a Desktop; Chapter 10: Swing Dialogs; 10.1 The JDialog Class; 10.2 The JOptionPane Class; 10.3 Using JOptionPane; 10.4 Simple Examples; 10.5 Getting the Results; 10.6 A Comparison: Constructors Versus Static Methods; 10.7 Using Internal Frame Dialogs with JDesktopPane; Chapter 11: Specialty Panes and Layout Managers; 11.1 The JSplitPane Class; 11.2 The JScrollPane Class; 11.3 The JTabbedPane Class; 11.4 Layout Managers; 11.5 The SpringLayout Class; 11.6 Other Panes; Chapter 12: Chooser Dialogs; 12.1 The JFileChooser Class; 12.2 The File Chooser Package; 12.3 The Color Chooser; 12.4 The JColorChooser Class; 12.5 Developing a Custom Chooser Panel; 12.6 Developing a Custom Preview Panel; 12.7 Developing a Custom Dialog; Chapter 13: Borders; 13.1 Introducing Borders; 13.2 Painting Borders Correctly; 13.3 Swing Borders; 13.4 Creating Your Own Border; Chapter 14: Menus and Toolbars; 14.1 Introducing Swing Menus; 14.2 Menu Bar Selection Models; 14.3 The JMenuBar Class; 14.4 The JMenuItem Class; 14.5 The JPopupMenu Class; 14.6 The JMenu Class; 14.7 Selectable Menu Items; 14.8 Toolbars; Chapter 15: Tables; 15.1 The JTable Class; 15.2 Implementing a Column Model; 15.3 Table Data; 15.4 Selecting Table Entries; 15.5 Rendering Cells; 15.6 Editing Cells; 15.7 Next Steps; Chapter 16: Advanced Table Examples; 16.1 A Table with Row Headers; 16.2 Large Tables with Paging; 16.3 A Table with Custom Editing and Rendering; 16.4 Charting Data with a TableModel; Chapter 17: Trees; 17.1 A Simple Tree; 17.2 Tree Models; 17.3 The JTree Class; 17.4 Tree Nodes and Paths; 17.5 Tree Selections; 17.6 Tree Events; 17.7 Rendering and Editing; 17.8 What Next?; Chapter 18: Undo; 18.1 The Swing Undo Facility; 18.2 The UndoManager Class; 18.3 Extending UndoManager; Chapter 19: Text 101; 19.1 The Swing Text Components; 19.2 The JTextComponent Class; 19.3 The JTextField Class; 19.4 A Simple Form; 19.5 The JPasswordField Class; 19.6 The JTextArea Class; 19.7 How It All Works; Chapter 20: Formatted Text Fields; 20.1 The JFormattedTextField Class; 20.2 Handling Numerics; 20.3 The DefaultFormatter Class; 20.4 The MaskFormatter Class; 20.5 The InternationalFormatter Class; 20.6 The DateFormatter Class; 20.7 The NumberFormatter Class; 20.8 The DefaultFormatterFactory Class; 20.9 Formatting with Regular Expressions; 20.10 The InputVerifier Class; Chapter 21: Carets, Highlighters, and Keymaps; 21.1 Carets; 21.2 Highlighters; 21.3 Keymaps; Chapter 22: Styled Text Panes; 22.1 The JTextPane Class; 22.2 AttributeSets and Styles; 22.3 The Document Model; 22.4 Document Events; 22.5 Views; 22.6 The DocumentFilter Class; 22.7 The NavigationFilter Class; Chapter 23: Editor Panes and Editor Kits; 23.1 The JEditorPane Class; 23.2 Overview of the Editor Kits; 23.3 HTML and JEditorPane; 23.4 Hyperlink Events; 23.5 The HTMLEditorKit Class; 23.6 Extending HTMLEditorKit; 23.7 Editing HTML; 23.8 Writing HTML; 23.9 Reading HTML; 23.10 A Custom EditorKit; Chapter 24: Drag and Drop; 24.1 What Is Drag and Drop?; 24.2 The Drop API; 24.3 The Drag Gesture API; 24.4 The Drag API; 24.5 Rearranging Trees; 24.6 Finishing Touches; Chapter 25: Programming with Accessibility; 25.1 How Accessibility Works; 25.2 The Accessibility Package; 25.3 Other Accessible Objects; 25.4 Types of Accessibility; 25.5 Classes Added in SDK 1.3 and 1.4; 25.6 The Accessibility Utility Classes; 25.7 Interfacing with Accessibility; Chapter 26: Look and Feel; 26.1 Mac OS X and the Default Look-and-Feel; 26.2 How Does It Work?; 26.3 Key Look-and-Feel Classes and Interfaces; 26.4 The MultiLookAndFeel; 26.5 Auditory Cues; 26.6 Look-and-Feel Customization; 26.7 Creation of a Custom Look-and-Feel; Chapter 27: Swing Utilities; 27.1 Utility Classes; 27.2 The Timer Class; 27.3 Tooltips; 27.4 Rendering Odds and Ends; 27.5 Event Utilities; Chapter 28: Swing Under the Hood; 28.1 Working with Focus; 28.2 Multithreading Issues in Swing; 28.3 Lightweight Versus HeavyweightComponents; 28.4 Painting and Repainting; 28.5 Creating Your Own Component; Appendix A: Look-and-Feel Resources; Appendix B: Component Actions; B.1 JButton; B.2 JCheckBox; B.3 JCheckBoxMenuItem; B.4 JComboBox; B.5 JDesktopPane; B.6 JEditorPane; B.7 JFormattedTextField; B.8 JInternalFrame; B.9 JLabel; B.10 JList; B.11 JMenu; B.12 JMenuBar; B.13 JMenuItem; B.14 JOptionPane; B.15 JPasswordField; B.16 JPopupMenu; B.17 JProgressBar; B.18 JRadioButton; B.19 JRadioButtonMenuItem; B.20 JRootPane; B.21 JScrollBar; B.22 JScrollPane; B.23 JSlider; B.24 JSpinner; B.25 JSplitPane; B.26 JTabbedPane; B.27 JTable; B.28 JTextArea; B.29 JTextField; B.30 JTextPane; B.31 JToggleButton; B.32 JToolBar; B.33 JToolTip; B.34 JTree; B.35 JViewport; B.36 Non-JComponent Containers; B.37 Auditory Feedback Actions; Colophon;