
Swing Hacks
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Content
- Intro
- Contents
- Credits
- About the Authors
- Contributors
- Acknowledgments
- Joshua
- Chris
- Preface
- Why Swing Hacks?
- How to Use This Book
- How This Book Is Organized
- Conventions Used in This Book
- Using Code Examples
- How to Contact Us
- Got a Hack?
- Safari Enabled
- Basic JComponents
- Create Image-Themed Components
- Don't Settle for Boring Text Labels
- Fill Your Borders with Pretty Pictures
- Display Dates in a Custom Calendar
- Create the Images
- A Component to Paint
- Draw the Days of the Month
- Add a Watermark to a Text Component
- Watermark Your Scroll Panes
- Put a NASA Photo into the Background of a Text Area
- Animate Transitions Between Tabs
- Building a Basic Tabbed Pane
- Scheduling the Animation
- Drawing the Animation
- Putting It All Together
- Another Example
- Blur Disabled Components
- Building a Drop-Down Menu Button
- Adding a Color Selection Panel
- Create Menus with Drop Shadows
- Add Translucence to Menus
- Make the Custom Menu Item
- Add a Custom JMenu
- Test It Out
- Future Ideas
- Lists and Combos
- Filter JLists
- Add a Filter History
- Make JLists Checkable
- Make Different List Items Look Different
- Reorder a JList with Drag-and-Drop
- Animate Your JList Selections
- Turn Methods into List Renderers
- Building a Generic Renderer
- Putting It All Together
- Create a Collections-Aware JComboBox
- Tables and Trees
- Size Your Columns to Suit Your JTable's Contents
- Resetting Column Widths
- Accounting for Header Cells
- Hacking the Hack
- Add Column Selection to JTables
- Let Your JTables Do the Sorting
- Create a JDBC Table Model
- Building Connectivity
- Testing Things Out
- Export Table Data to an Excel Spreadsheet
- Dealing with Formatting
- Search Through JTables Easily
- JTable Search Strategy
- Decorating the TableModel
- Creating Logical Links to the Inner Table Model
- Indexing
- Searching
- Getting results from the index
- Recreating the inner table model links
- Try It Out
- Finishing Touches
- Listen to inner table updates
- Clear search results for blank search
- Wrapping Up
- Animate JTree Drops
- The Code
- Running the Code
- File Choosers
- Add a Right-Click Context Menu to the JFileChooser
- The Problem
- Display Shortcuts in the JFileChooser
- Real Windows Shortcut Support
- Add Image Preview to File Choosers
- Preview ZIP and JAR Files
- Build File Proxies
- Build a Custom Filesystem View
- Put It All Together
- Windows, Dialogs, and Frames
- Window Snapping
- Make a Draggable Window
- Add Windows Resize Icons
- A Tale of Two Icons
- The Icon Interface
- The Explorer Icon
- The Office Icon
- Add Status Bars to Windows
- Standard Status Bars
- Painting Panel Details
- Add the Corner Icon
- Add the Left Component
- Add a Separator Panel
- And the Rest...
- Running the Hack
- Save Window Settings
- The Window Saver Class
- Earthquake Dialog
- Exterior Animation
- Shake, Rattle, and Roll
- Spin Open a Detail Pane
- The Invisible Man
- Now You See Me
- Minimize to a Mini-Frame
- I Shall Call Him...Mini-Me
- Minimize the Frame
- Restore the Frame
- Transparent and Animated Windows
- Transparent Windows
- Make Your Frame Dissolve
- Prepare the Dissolve
- Run the Animation
- Do the Drawing
- Create a Genie Effect
- Create Custom Tool Tips
- Install the Tool Tip
- Turn Dialogs into Frame-Anchored Sheets
- Why Sheets Rock
- Use the Glass Pane
- Animating a Sheet Dialog
- Animate the Sheet
- Self-Painting
- Slide Notes Out from the Taskbar
- Figure Out Where You Are
- Running the Hack
- Hacking the Hack
- Indefinite Progress Indicator
- The Swing Solution
- Picture as Indicator
- The Glass Pane as an Indicator
- Build the Circular Shape
- Paint the Indicator
- Run the Animation Thread
- Text
- Make Text Components Searchable
- A Basic Search Class
- Running the Search
- Adding Search to Swing Components
- Hacking the Hack
- Force Text Input into Specific Formats
- Constraining a Document
- Adding Constrained Text Fields
- Auto-Completing Text Fields
- A Self-Completing Text Field
- Test Out Auto-Complete
- Write Backward Text
- Messing with JLabel
- Mirror, Mirror on the Wall
- Use HTML and CSS in Text Components
- Here's the Trick
- Use Global Anti-Aliased Fonts
- The Problem
- Anti-Aliased Text Without Code
- The Java 5.0 Trick
- Anti-Aliased Text with a Custom Look and Feel
- The Wrap Look and Feel
- Rendering
- Create a Magnifying Glass Component
- Build the Magnifying Glass
- Testing the Magnifier Out
- Hacking the Hack
- Create a Global Right-Click
- Block a Window Without a Modal Dialog
- Blocking Basics
- Build a Test Process
- Putting It All Together
- Create a Color Eyedropper
- Changing Fonts Throughout Your Application
- Changing the Default Fonts
- Fonts 'R' Us
- Load New Fonts at Runtime
- The Wonders of createFont( )
- Testing Font Loading
- Build a Colorful Vector-Based Button
- Use Scaling to Your Advantage
- Hacking the Hack
- Add a Third Dimension to Swing
- The Problems with Java3D
- Faking Transparency
- Turn the Spotlight on Swing
- The Metaphor
- Add the Spotlight
- Drag-and-Drop
- Drag-and-Drop with Files
- Handle Dropped URLs
- Drag Away
- Handle Dropped Images
- Grabbing the Drop
- Shut Up and Drag
- Handling Dropped Picts on Mac OS X
- Take a Breath and Run
- Translucent Drag-and-Drop
- A Rather Boring Cursor
- Translucence Rocks
- Drawing a Ghost
- Audio
- Play a Sound in an Applet
- The Code
- No Browser, No Sound
- Play a Sound with JavaSound
- Putting JavaSound to Work
- Listen Up
- Play a Sound with Java Media Framework
- Installing JMF
- The Code
- Take JMF for a Spin
- Play a Sound with QuickTime for Java
- QuickTime Beating Up on JavaSound
- Compiling QuickTime Code
- Running the Code
- Add MP3 Support to JMF
- Add a Plug-In to JMF
- Simplicity Is Nice
- Distribute Your Program
- Build an Audio Waveform Display
- Some Basic Definitions
- Load the Raw Data
- Convert to Samples and Channels
- Creating a Single Waveform Display
- Create a Container
- Seeing Is Believing
- Play Non-Trivial Audio
- Grabbing a DataLine
- Big Files, Big Sound
- Show Audio Information While Playing Sound
- The Code
- Testing It Out
- Hacking the Hack
- Running the Hacked Hack
- Provide Audio Controls During Playback
- Theory to Practice
- Check It Out!
- Native Integration and Packaging
- Launch External Programs on Windows
- The Power of Runtime.exec( )
- Open a Text File
- Open a URL
- Open a Directory
- Open Files, Directories, and URLs on Mac OS X
- Using Open
- Handle Spaces
- Make Mac Applications Behave Normally
- Using the Apple System Properties
- Using the Mac's Menu Bar
- Presenting an Appropriate Application Name
- Showing the Mac Grow Box
- Jump on the Brushed Metal Bandwagon
- Control iTunes on Mac OS X
- Apple Events
- Control iTunes Under Windows
- Working with COM
- Get Track Information
- Construct Single-Launch Applications
- Local Sockets
- Stuff Stuff in JARs
- An Obvious Secret
- Showing Off
- Packing Up
- Double-Clicking JARs
- And the Kitchen Sink
- Make Quick Look and Feel Changes
- Look and Feel Properties
- Text Components
- Use System Colors
- Create an Inverse Black-and-White Theme
- A Black-and-White Theme
- Miscellany
- Display a Busy Cursor
- Pre-Generating Images
- Running the Animation
- Put It All Together
- And More...
- Fun with Keyboard Lights
- Create Demonstrations with the Robot Class
- I, Robot
- Check Your Mail with Swing
- Don't Block the GUI
- To Block or Not to Block
- Code Models That Don't Block
- Models Aren't Always Dumb
- Running the Code
- Exposing the Threading
- Fire Events and Stay Bug Free
- The Problem
- And It Gets Worse
- Hacking a Solution
- Debug Your GUI
- Hijacking Output Streams
- Debug Components with a Custom Glass Pane
- Screens and Glass
- Mirror an Application
- Set Up a Window
- Become a Server or Client
- Send Mouse Events
- Receive Mouse Events
- Component Problems
- Add Velocity for Dynamic HTML
- Velocity and Templates
- Create the HTML
- Create a Data Object
- Create a Velocity Context
- Fill the Template with Values
- Sunny Outside?
- Get Large File Icons
- Make Frames Resize Dynamically
- A Word About Speed
- Index
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.