
v
Contents
Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Chapter 1. Basic JComponents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1. Create Image-Themed Components 1
2. Don’t Settle for Boring Text Labels 8
3. Fill Your Borders with Pretty Pictures 14
4. Display Dates in a Custom Calendar 19
5. Add a Watermark to a Text Component 23
6. Watermark Your Scroll Panes 26
7. Put a NASA Photo into the Background of a Text Area 29
8. Animate Transitions Between Tabs 32
9. Blur Disabled Components 39
10. Building a Drop-Down Menu Button 43
11. Create Menus with Drop Shadows 49
12. Add Translucence to Menus 52
Chapter 2. Lists and Combos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
13. Filter JLists 58
14. Add a Filter History 63
15. Make JLists Checkable 66
16. Make Different List Items Look Different 70
17. Reorder a JList with Drag-and-Drop 80
18. Animate Your JList Selections 87