开发者

Jframe does not remember it' s position after minimizing

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 diffe开发者_运维技巧rent co-ordinates ..i want that jframe should open at the same position...after maximizing..like remeber it's position..

please help


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);
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜