I've seen frame.setAlwaysOnTop(true);
with JFrame but I need the frame to do just opposite, always on bottom. How I can do it?
Asked
Active
Viewed 493 times
-1

Piyush Mishra
- 327
- 1
- 11
-
1The question here would be... Why? This could be a really bad UX... I'd need to minimize all other apps in order to use it... However [this](https://stackoverflow.com/questions/2032248/making-an-unfocusable-window-in-java) might be related – Frakcool Oct 23 '17 at 18:24
-
I need it because I'm trying to make someting like desktop manager. – Piyush Mishra Oct 23 '17 at 18:32
-
You could use a combination of a `Swing `Timer` and [`Window#toBack`](https://docs.oracle.com/javase/8/docs/api/java/awt/Window.html#toBack--) to force the window to the bottom of the window stack, but I'm not sure what advantage it would bring you. I'd also be considered about the ability for a user to interact with the window as well – MadProgrammer Oct 23 '17 at 19:41
-
*"I need it because I'm trying to make someting like desktop manager"* If you mean this frame is supposed to somehow manage other apps which were not launched by it, then Java is the wrong language for this. Use something that can reach further into the bowels of the OS. This will likely mean the language is specific to the OS (e.g. .Net for Windows). – Andrew Thompson Oct 24 '17 at 01:16
1 Answers
1
If you don't want the user to interact with it just use setVisible(false) and set it true if/when needed

João Pedro Abubakir
- 56
- 1
- 7
-
What do you mean as "on bottom", behind all other window or on system tray? – João Pedro Abubakir Oct 23 '17 at 19:07
-
-
You can maybe override `toFront` so nothing can pull it forward, You can use `setFocusableWindowState(false)` so the window can't be focused Add a listener to execute a `toBack()` method. – João Pedro Abubakir Oct 23 '17 at 19:10
-
You can check the docs for the method here https://docs.oracle.com/javase/6/docs/api/java/awt/Window.html#setFocusableWindowState(boolean) – João Pedro Abubakir Oct 23 '17 at 19:13
-
But I don't see a point in making it behind everything but still have it on screen. I don't think this is possible using java since it does not have a low level system integration. Java runs on a virtualization layer. Are you trying to do something like wallpaper engine? – João Pedro Abubakir Oct 23 '17 at 19:15
-
Have you ever heard about Gnome or KDE? I'm trying to make something like that which directly runs on X Server. :D – Piyush Mishra Oct 23 '17 at 19:18
-
Have you checked WeirdX? I think you can find a lot of what you want to do there http://www.jcraft.com/weirdx/ – João Pedro Abubakir Oct 23 '17 at 19:21