14 Years
Discussion Span
Last Post by DeepZ

Sounds easy, but...

Two options :
A] Use Java2 Version 1.5. The option seems to be included there.
B] Use a WindowListener handler for the WindowDeactivated event and call the toFront() method there. However, this seems to only work for your own (java-generated) frames/windows but not for other apps windows; they can still cover your frame.

The second option goes something like :

public class AllWaysOnTop extends JFrame implements WindowListener {

        AllWaysOnTop() {
            ... Code to setup your frame
            ... Code to show your frame

        // The window event handlers. We use WindowDeactivated to
        // try and keep the splashscreen on top. Usually only keeps
        // the splashscreen on top of our own java windows.
        public void windowOpened(WindowEvent event){};
        public void windowActivated(WindowEvent event){};
        public void windowDeactivated(WindowEvent event){
        public void windowIconified(WindowEvent event){};
        public void windowDeiconified(WindowEvent event){};
        public void windowClosed(WindowEvent event){};
        public void windowClosing(WindowEvent event) {};
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.