aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes making a JFrame nonFocusable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "making a JFrame nonFocusable" Watch "making a JFrame nonFocusable" New topic
Author

making a JFrame nonFocusable

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
JOptionPane has methods which take a component as an argument, like this:


Anyway, when the JOptionPane is asking the user if the user wants to save the file, the frame is unusable. I want to do that to a frame. I used frame.setFocusable(false); but it didn't work. Even after I called that method, I was still able to focus on the frame by clicking it.
How can I do it?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
open up a modal JDialog, setUndecorated(true), setSize(0,0)

when the frame is the active window, even though you can't access it,
alt-F4 will close the dialog, then you can do whatever you want with the frame.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: making a JFrame nonFocusable