From 5404a5661ebc8630dde45d00c20fba60559137bc Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Mon, 15 Jan 2007 17:46:01 +0000 Subject: [PATCH] save window size and location on dispose --- .../gui/customcontrols/SIPCommDialog.java | 21 ++++++++++++++----- .../impl/gui/customcontrols/SIPCommFrame.java | 11 ++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java index 63e6b47fa..0dc124c6f 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java @@ -182,16 +182,27 @@ public void setVisible(boolean isVisible) if(isVisible) { this.pack(); this.setSizeAndLocation(); + + JButton button = this.getRootPane().getDefaultButton(); + + if(button != null) + button.requestFocus(); } - JButton button = this.getRootPane().getDefaultButton(); - - if(button != null) - button.requestFocus(); - super.setVisible(isVisible); } + /** + * Overwrites the dispose method in order to save the size and the position + * of this window before closing it. + */ + public void dispose() + { + super.dispose(); + + this.saveSizeAndLocation(); + } + /** * All functions implemented in this method will be invoked when user * presses the Escape key. diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java index 03e8f7268..b3d2510ca 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java @@ -175,6 +175,17 @@ public void setVisible(boolean isVisible) super.setVisible(isVisible); } + /** + * Overwrites the dispose method in order to save the size and the position + * of this window before closing it. + */ + public void dispose() + { + super.dispose(); + + this.saveSizeAndLocation(); + } + /** * All functions implemented in this method will be invoked when user * presses the Escape key.