This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

making a JFrame nonFocusable

 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic