2003/06/13 09:19:10
[org.ibex.core.git] / src / org / xwt / plat / Java2.java
index 629858c..1b54053 100644 (file)
@@ -17,7 +17,9 @@ import java.lang.reflect.*;
 public class Java2 extends AWT {
 
     private boolean isJava14 = false;
-    protected boolean _supressDirtyOnResize() { return isJava14 ? false : true; }
+    protected boolean _supressDirtyOnResize() {
+       return (isJava14 && !System.getProperty("os.name", "").equals("Mac OS X"))? false : true;
+    }
 
     public Java2() {
         // disable the focus manager so we can intercept the tab key
@@ -104,7 +106,21 @@ public class Java2 extends AWT {
     protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new Java2DoubleBuffer(w, h); }
     protected Surface _createSurface(final Box root, final boolean framed) {
         return (Surface)java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
-                public Object run() { return isJava14 ? new Java14Surface(root, framed) : new Java2Surface(root, framed); }
+                public Object run() {
+                   if (isJava14) {
+                       try {
+                            // weaken the binding here to avoid link errors on 1.3.x
+                            Class java14SurfaceClass = Class.forName(Java2.class.getName() + "$Java14Surface");
+                            Constructor ctor = java14SurfaceClass.getConstructor(new Class[] { Box.class, Boolean.TYPE });
+                            return (Surface)ctor.newInstance(new Object[] { root, new Boolean(framed) });
+                       } catch (Exception e) {
+                           Log.log(this, e);
+                           throw new LinkageError("error: " + e);
+                       }
+                   } else {
+                       return new Java2Surface(root, framed);
+                   }
+               }
             });
     }
 
@@ -263,9 +279,11 @@ public class Java2 extends AWT {
             });
     }
 
-    protected String getDescriptiveName() { return "Java 1.2+ JVM"; }
+    protected String getDescriptiveName() { return isJava14 ? "Java 1.4+ JVM" : "Java 1.2+ JVM"; }
 
     protected void _newBrowserWindow(String url) {
+       /*
+         FIXME
         if (Main.applet == null) {
             if (Log.on) Log.log(this, "Main.applet is null; cannot invoke showDocument()");
             return;
@@ -276,6 +294,7 @@ public class Java2 extends AWT {
         } catch (MalformedURLException e) {
             if (Log.on) Log.log(this, e);
         }
+       */
     }
 
 }