2003/02/06 19:07:15
[org.ibex.core.git] / src / org / xwt / plat / Java12.java
index c277efa..eed6391 100644 (file)
@@ -16,12 +16,21 @@ import java.lang.reflect.*;
 /** Platform class for most reasonable Java1.2+ JVMs */
 public class Java12 extends AWT {
 
+    public Java12() {
+        // disable the focus manager so we can intercept the tab key
+        javax.swing.FocusManager.setCurrentManager(new javax.swing.FocusManager() {
+                public void processKeyEvent(Component focusedComponent, KeyEvent anEvent) { }
+                public void focusPreviousComponent(Component aComponent) { }
+                public void focusNextComponent(Component aComponent) { }
+            });
+    }
+
     /** this is done with reflection in case a new version of the plugin comes out that doesn't let us pull the sun.plugin.* trick */
-    protected synchronized HTTP.ProxyInfo _detectProxy() {
-        return (HTTP.ProxyInfo)java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
+    protected synchronized org.xwt.Proxy _detectProxy() {
+        return (org.xwt.Proxy)java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
                 public Object run() {
                     try {
-                        HTTP.ProxyInfo pi = new HTTP.ProxyInfo();
+                        org.xwt.Proxy pi = new org.xwt.Proxy();
                         
                         Class PluginProxyHandler = Class.forName("sun.plugin.protocol.PluginProxyHandler");
                         Method getDefaultProxyHandler = PluginProxyHandler.getMethod("getDefaultProxyHandler", new Class[] { });
@@ -83,6 +92,10 @@ public class Java12 extends AWT {
 
     // Inner Classes //////////////////////////////////////////////////////////////////
 
+    private static Cursor invisibleCursor =
+        Toolkit.getDefaultToolkit().createCustomCursor(new BufferedImage(2, 2, BufferedImage.TYPE_INT_ARGB),
+                                                       new Point(1, 1), "invisible");
+
     protected static class Java12Surface extends AWTSurface {
         
         public Java12Surface(Box root, boolean framed) { super(root, framed); }
@@ -105,6 +118,11 @@ public class Java12 extends AWT {
             if (b) frame.setState(java.awt.Frame.ICONIFIED);
             else frame.setState(java.awt.Frame.NORMAL);
         }
+
+        public void syncCursor() {
+            if (cursor.equals("invisible")) window.setCursor(invisibleCursor);
+            else super.syncCursor();
+        }
     }
 
     protected static class Java12DoubleBuffer extends AWTDoubleBuffer {