File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How keep window on top but use other windows?

 
Dan Bizman
Ranch Hand
Posts: 387
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In windows 2K and later, they have the ability to make a window always appear over others even if it loses focus, so it's over another window but you can still use that other window. Is there a way to do this in java? Will it work on Linux/Mac?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47274
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand whether you wish to do that with the OS or in Java. Have you tried the setAlwaysOnTop() or toFront() methods of java.awt.Window, which are inherited by JFrame? Do they do what you want?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47274
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Linux you can r-click the icon of your window in the bottom panel, or click the icon on the top left of the window and you get a dropdown list including "on top". That might be what you want.
 
Dan Bizman
Ranch Hand
Posts: 387
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
toFront won't work because it grabs focus.
setAlwaysOnTop is 1.5+ only and I'm not certain it works properly as I've seen a number of bug requests stating that it also grabs focus and doesn't work properly on Linux.

I know how to write the JNI for this to work on Windows, but not sure what to do for Linux. I've read that gtk+ (which I believe is used by gnome) has "keep_above" as a method you can call but I don't know if that'll work in all of linux, nor if it works on mac.

Is there a solution? Anyone have the code or some open source that does it in JNI?
 
Dan Bizman
Ranch Hand
Posts: 387
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JNI code would be great. I have the JNI for windows, I just need it for linux/mac.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic