Prasanna
- All
- Personal
- Sports
- Sun
- Tech
- Useful Code
Thursday Apr 26, 2007
Swing: The problem with JFrame.toFront
I was trying to make a JFrame active after it was minimized. The code snippet is as followsJFrame frame = new JFrame(.....);
....
....
if (frame.isVisible() == true)
{
  frame.toFront();
  frame.setState(Frame.NORMAL);
}
The above code works, but fails to make the frame active and one needs to click the frame window again to make it active. There were other alternatives like
frame.requestFocus() and frame.requestFocusInWwindow(), but they didn't produce the desired results I expected. I am not sure about the sequence of APIs which would accomplish the task.
Interestingly, there were lot of discussions about the behavior of JFrame.toFront() , but the question is can we make a minimized JFrame active.
Posted at 11:17PM Apr 26, 2007 by prasanna in Tech | Comments[3]


Posted by Abe on August 02, 2007 at 03:52 AM IST #
Posted by Prasanna Seshadri on August 02, 2007 at 03:48 PM IST #
If not too late you can use the same technique as in here:
http://forums.sun.com/thread.jspa?threadID=777887&messageID=4427023
Posted by sans17 on August 28, 2008 at 03:53 AM IST #