From ca8d0905c8e12d55e76c38b47a4c2fa318809f43 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 3 Oct 2008 13:46:30 +0000 Subject: [PATCH] respect screen size when displaying dialog --- .../sics/cooja/dialogs/ProjectDirectoriesDialog.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java index 97a6f994a..cd20a8297 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ProjectDirectoriesDialog.java,v 1.8 2008/10/03 10:26:16 fros4943 Exp $ + * $Id: ProjectDirectoriesDialog.java,v 1.9 2008/10/03 13:46:30 fros4943 Exp $ */ package se.sics.cooja.dialogs; @@ -588,6 +588,16 @@ class ConfigViewer extends JDialog { contentPane.add(buttonPane, BorderLayout.SOUTH); pack(); + + /* Respect screen size */ + Rectangle maxSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + if (maxSize != null && (getSize().width > maxSize.width)) { + setSize(maxSize.width, getSize().height); + } + if (maxSize != null && (getSize().height > maxSize.height)) { + setSize(getSize().width, maxSize.height); + } + } }