
Indefinite Progress Indicator #47
Chapter 6, Transparent and Animated Windows
|
247
HACK
Figure 6-11 shows the slide-in window on Mac OS X. It’s less appropriate
on the Mac, and it will be obscured if the user has dock magnification
turned on, but it’s not really bad either.
Hacking the Hack
To expand this hack, the first thing you’d probably want to do is add some
kind of
MouseListener so that if the user clicks to acknowledge the appear-
ance of the slide-in window, you could react to it by removing the slide-in
window, bringing your application’s main window to the front, etc. Then
again, you can put live components in here, so there’s no reason you
couldn’t just generate a
JOptionPane, make a JDialog from it, grab the con-
tent pane of that
JDialog, and show it in the slide-in window. That would
give you real, active Swing buttons and handy
JOptionPane return values.
After all, that’s what the sheet example did.
H A C K
#47
Indefinite Progress Indicator Hack #47
Despite its numerous advanced widgets, Swing offers no efficient way to
show that a task of unknown length is in progress. This hack presents two
solutions to address this issue.
Have you ever watched an application do something, but not tell you what
that something is? Other applications let you know what’s going on but
don’t really tell you how long they will need to complete the task. For
instance, the Microsoft Windows copy dialog is famous