I came across a very typical difference in the behavior or JFrame and JWindow.

I am maintaining a desktop application developed in java swing with one of the functionality to capture the screen. The application is a JFrame with various buttons added to it. The JFrame is set as setAlwaysOnTop(true). This screen capture works fine for all cases expect when OpenOffice presentation is running in slideshow mode on Ubuntu 8.04.

When the slideshow for presentation is activated, the presentation is coming on top of JFrame. Even though JFrame is declared as setAlwaysOnTop, it is not coming on top of slideshow. This is preventing the user from initiating the capture. This is happening only on Ubuntu (and other Linux Flavor). It works fine on Windows.

When I made a minor change (i.e. changed the JFrame to JWindow), it is staying always on top even when slideshow is activated.

Please go though the below example code. When the below code is run, the JFrame stays on top till a presentation is opened and slideshow activated. When slide show is running, it goes behind the slide show. If you change the JFrame to JWindow (shown in commented line), it is staying always on top even when slideshow is activated and we donít even have the setAlwaysOnTop() property for JWindow.

import javax.swing.JFrame;
import javax.swing.JWindow;

public class TopJFrameTester {

public static void main(String[] args) {

//JWindow topContainer = new JWindow();
JFrame topContainer = new JFrame();
topContainer.setSize(300, 300);


Can anybody explain how can I make my JFrame to sit on top of PPT slide show as that of JWindow or any workaround to achieve this?

Any help in this regard is highly appreciated.

Thanks & Regards,