devxlogo

Always on top window

Always on top window

Question:
Is it possible to create an ‘always on top window’ in java?

Answer:
The short and perhaps not so sweet answer is “No.” At least not in 100%Java. You can always write native code to implement this using native windowing system calls. However, if all you want is to keep a windowon top of all of your subwindows in a master Java window a la MDI, thenyou can do this using the Swing JInternalFrame class or the JLayeredPaneclass. In each case all you have to do is set the layer (withsetLayer()) of the JInternalFrame or component added to JLayeredPane sothat it is higher than that of any other component.

devx-admin

Share the Post: