Table of Contents

preface xi

intended audience xiii

hardware and software requirements xiv

Author Online xv

how this book is organized xvi

conventions used in this book xvii

review process for this book xviii

about the cover illustration xx

special thanks xxi

Part 1   An introduction to Swing 1

1   The basics 3

1.1 Why Swing? 4

1.2 The basics 6

Where's Swing? 7, Porting from AWT to Swing 7

1.3 The idea behind Swing 10

1.4 Swing is not AWT 13

2   Into the Swing of things 17

2.1 Swing controls similar to those in AWT 18

2.2 Basic components in Swing 19

JComponent 19, JFrame and JDialog 20, JPanel 21, JButton 21, JMenu 23, JList and JComboBox 24, JTextField and JTextArea 25, JApplet 27

2.3 Going pro: advanced Swing 27

A simple application 27

2.4 It don't mean a thing if it ain't got that Swing 32

Icons 32, Actions 32, Borders 33, Scrollable 34

2.5 The new containers 35

JLayeredPane 35, JDesktopPane 36, JSplitPane 37, JTabbedPane 37

2.6 The new components 38

JTree 38, JTable 41, JToolBar 43, JOptionPane 44, JSlider 44, JProgressBar 45

2.7 The Swing text components 46

JEditorPane 47

2.8 The new layout managers 49

2.9 The undo package 50

2.10 Swing, color, and the UIDefaults table 51

2.11 Multithreading and Swing 53

2.12 About Swing bugs 54

3   Pluggable look and feel 57

3.1 Using predefined pluggable look and feels 58
Custom painting components 59

3.2 Pluggable Picasso: writing a custom look and feel 60

3.3 Themes 66

3.4 About the Multi look and feel 68

4   The Accessibility API 71

4.1 Using the Accessibility API 73

4.2 Understanding the Accessibility API 75

4.3 Accessibility through pluggable look and feel 79

The end result 79

Part 2   Swing Reference 81

Package accessibility 83
Accessibility extends/implements hierarchy 84, Quick summary 84, FAQs 84

Package swing 107

Swing extends/implements hierarchy 108, Quick summary 113, Action summary 113, Button summary 113, Layout summary 113, List summary 113, Menu summary 114, Panel summary 114, Bounded Range summary 114, Scrolling summary 114, Text summary 115, Container summary 115, Models, implementations, and views 115, JComponent FAQs 211, JDialog FAQs 227, JFrame FAQs 249, JList FAQs 273, JMenuBar FAQs 288, JPanel FAQs 305, JTable FAQs 358, JTextArea FAQs 376, JTree FAQs 394

Package swing.border 461

Border extends/implements hierarchy 461, Quick summary 462, FAQs 462

Package swing.colorchooser 477

Colorchooser extends/implements hierarchy 477, Quick summary 477, FAQs 478

Package swing.event 481

Event extends/inherits hierarchy 482, Summary 483

Package swing.filechooser 517

Filechooser extends/implements hierarchy 517, Quick summary 517, FAQs 518

Package swing.plaf 521

Plaf extends/implements hierarchy 522, Quick summary 523, FAQs 524

Package swing.plaf.basic 547

Basic extends/implements hierarchy 548, Quick summary 549, FAQs 549

Package swing.table 733

Table extends/implements hierarchy 734, Quick summary 734, FAQs 735

Package swing.text 769

Text extends/implements hierarchy 770, Quick summary 777, FAQs 777

Package swing.text.html 899

HTML extends/implements hierarchy 900, Quick summary 901, FAQs 901

Package swing.html.parser 941

Parser extends/implements hierarchy 942

Package swing.text.rtf 951

Rtf extends/implements hierarchy 951, Quick summary 951, FAQs 951

Package swing.tree 955

Tree extends/implements hierarchy 956, Quick summary 956, FAQs 956

Package swing.undo 995

Undo extends/implements hierarchy 996, Quick summary 996, FAQs 996

appendix A   Related information sources 1011

appendix B   UIDefaults table standard keys 1013

appendix C   Swing events, listener interfaces, and event sources 1024

index 1029