You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/01/25 02:01:36 UTC

svn commit: r499632 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: apps/svgbrowser/JSVGViewerFrame.java util/Platform.java

Author: cam
Date: Wed Jan 24 17:01:35 2007
New Revision: 499632

URL: http://svn.apache.org/viewvc?view=rev&rev=499632
Log:
1. Unmaximize Squiggle window if the "Automatically resize window when
   loading documents" option is turned on.

PR: 32415

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/Platform.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java?view=diff&rev=499632&r1=499631&r2=499632
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java Wed Jan 24 17:01:35 2007
@@ -518,6 +518,7 @@
                     setPreferredSize(d);
                     invalidate();
                     if (JSVGViewerFrame.this.autoAdjust) {
+                        Platform.unmaximize(JSVGViewerFrame.this);
                         JSVGViewerFrame.this.pack();
                     }
                 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/Platform.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/Platform.java?view=diff&rev=499632&r1=499631&r2=499632
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/Platform.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/Platform.java Wed Jan 24 17:01:35 2007
@@ -18,6 +18,9 @@
  */
 package org.apache.batik.util;
 
+import java.awt.Frame;
+import java.lang.reflect.Method;
+
 /**
  * Platform specific functionality.
  *
@@ -37,4 +40,24 @@
      */
     public static boolean isJRE13 =
         System.getProperty("java.version").startsWith("1.3");
+
+    /**
+     * Unmaximizes the specified Frame.
+     */
+    public static void unmaximize(Frame f) {
+        if (!isJRE13) {
+            try {
+                Method m1 =
+                    Frame.class.getMethod("getExtendedState", (Class[]) null);
+                Method m2 =
+                    Frame.class.getMethod("setExtendedState",
+                                          new Class[] { Integer.TYPE });
+                int i = ((Integer) m1.invoke(f, (Object[]) null)).intValue();
+                m2.invoke(f, new Object[] { new Integer(i & ~6) });
+            } catch (java.lang.reflect.InvocationTargetException ite) {
+            } catch (NoSuchMethodException nsme) {
+            } catch (IllegalAccessException iae) {
+            }
+        }
+    }
 }