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
- double version = Double.parseDouble(System.getProperty("java.version", ""));
+ String versionString = System.getProperty("java.version", "");
+ int secondDecimal = versionString.substring(versionString.indexOf('.') + 1).indexOf('.');
+ if (secondDecimal != -1) versionString = versionString.substring(0, secondDecimal);
+ double version = Double.parseDouble(versionString);
if (version >= 1.4) {
isJava14 = true;
try {
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);
+ }
+ }
});
}
});
}
- 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;
} catch (MalformedURLException e) {
if (Log.on) Log.log(this, e);
}
+ */
}
}