tags:

views:

13

answers:

1

Hi My problem is that , The Jframe window does not remember it's position after minimizing ....suppose I minimize at co'ordiates (45,89)..but after maximizing it again open at (37,28)..means at different co-ordinates ..i want that jframe should open at the same position...after maximizing..like remeber it's position..

please help

A: 

You could save its position before being minimized and then, when it is restored, reset is location.

public class A extends JFrame implements WindowListener{
  //...

  private Point p;
  public void windowIconified(WindowEvent e) {
    //minimized
    p = getLocation();
  }
  public void windowDeiconified(WindowEvent e) {
    //restored
    setLocation(p);
  }
}
Michael Angstadt