SideBarFX
|
Fullscreen mode and transparent windows are supported in JavaSE 6 since update 10. I have developed the SideBar example for the JavaOne 2008 by using proprietary Java API to create translucent window that slides out of the right side of the screen. Now I am ready to show the SideBar example created by using the JavaFX API only. Let's create a fullscreen window first. In the current implementation such windows can be opaque only. By this reason this window cannot be used as a SideBar, but its width and height will be further used.
You should wait until the window appears in order to initialize its dimensions. As soon as the window's height becomes greater than 0, you can close the window and use its dimensions to initialize the main window. Note that if the auxiliary fullscreen window is closed before the main window is shown up, the application terminates.
The main window contains the following content. The base of the window is a translucent shape intended for processing of mouse events. This shape is based on a rectangle, whose left edge is a cubic curve instead of a line. Note that the shape of the window is not set, because JavaFX has no appropriate API. Besides, shaped windows do not support anti-aliasing.
The left edge of the shape is set off with a thick opaque cubic curve, whose parameters match those of the basic shape.
Drawn over the shape is the rotated translucent text. Although the text has the same color and opacity as the basic shape, the text looks less transparent, because the opacity values are summed up.
The close button is drawn in the right top corner of the main window.
The logo of Sun Microsystems is added to the center of the window. The clock widget from my first post about JavaFX is added over the logo. Note that the
The SideBar slides out when the mouse cursor hovers over the SideBar content and slides in when the mouse cursor leaves the window.
This approach has a couple of disadvantages. First, JavaFX has no API to keep the window on top of other windows even if it has the focus. Second, the closed fullscreen window does not receive events on the screen resolution changes. Therefore the SideBar will work incorrectly when the resolution changes. Note that the application is signed and requires all permissions to slide out off the screen. The source file of the example is available. |
![]() |
- Login or register to post comments
- Printer-friendly version
- malenkov's blog
- 1852 reads








Comments
by malenkov - 2009-03-29 23:31
No. I'm waiting for this feature in the common API. Hint: screen.impl_stageDelegate as com.sun.javafx.stage.FrameStageDelegate; delegate.window.setAlwaysOnTop(true); It requires some additional work because of non-public.by cheimpel - 2009-03-29 13:28
Have you tried JFXStage from JFXtras? it has an alwaysOnTop property.by thlandgraf - 2009-03-20 06:25
Works great on MacOSX with the Apple Port of Java5... seems that Apple did some compatibility work with the elder JVM.by dafei1288 - 2009-03-20 00:14
nice job.....by malenkov - 2009-03-19 12:55
@ilazarte: Try Java 6u10 or later because the SideBar uses transparent window.by malenkov - 2009-03-19 12:53
@prunge: I'll try to fix it by using the clip variable, but I can't test it because of single monitor.by prunge - 2009-03-18 15:44
Looks cool - but there are problems when running with multiple monitors. When it slides off my primary display (what would normally be the hidden state) it actually slides onto the left of my secondary monitor.by cozmint - 2009-03-18 06:26
Just a word: amazing.by ilazarte - 2009-03-19 12:35
dont see anything... winxp, java 1.5.0_10. i also launched it via chrome... i see the sidebar app in my application taskbar but i can't find it on screen...