
240
|
Chapter 6, Transparent and Animated Windows
#46 Slide Notes Out from the Taskbar
HACK
H A C K
#46
Slide Notes Out from the Taskbar Hack #46
Pop up a note above the taskbar when your application wants attention.
On Windows, long-running applications sometimes will slide in a window
above the taskbar to call attention to themselves when an interesting event
occurs, such as a finished download or an IM buddy’s appearance.
If you want to do this in Java, you need to deal with a pretty significant
problem: neither AWT nor Swing has any concept of the taskbar (where it
is, how big it is, whether it’s auto-hiding, or anything else). As a result, you
don’t know where to draw the window, and just taking a guess or hardcod-
ing something is hazardous—too high and the window floats inexplicably
on the desktop, too low and it gets buried under the taskbar.
Furthermore, how is this going to work on other operating systems? On the
Mac, the proper way to get attention is to bounce your application’s dock
icon. Since there’s no API exposing that functionality, can you at least use a
Windows-like slide-in window above the dock? Sure…if you can figure out
how tall the dock is (it’s user configurable), or whether the dock is even on
the bottom of the screen (it might be on the right or left, too).
Fortunately, it is possible to figure out what unobstructed space is available
to you on the main display. After that, ...