+ private boolean isJava14 = false;
+ protected boolean _supressDirtyOnResize() {
+ return false;
+ //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
+ 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 {
+ Toolkit t = java.awt.Toolkit.getDefaultToolkit();
+ Method m = java.awt.Toolkit.class.getMethod("setDynamicLayout", new Class[] { Boolean.class });
+ m.invoke(t, new Object[] { Boolean.TRUE });
+ } catch (Exception e) {
+ Log.log(this, "Exception while trying to enable AWT Dynamic Layout");
+ Log.log(this, e);
+ }
+ }
+ */
+ 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 org.xwt.HTTP.Proxy _detectProxy() {
+ return (org.xwt.HTTP.Proxy)java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
+ public Object run() {
+ try {
+ org.xwt.HTTP.Proxy pi = new org.xwt.HTTP.Proxy();
+
+ Class PluginProxyHandler = Class.forName("sun.plugin.protocol.PluginProxyHandler");
+ Method getDefaultProxyHandler = PluginProxyHandler.getMethod("getDefaultProxyHandler", new Class[] { });
+ Object proxyHandler = getDefaultProxyHandler.invoke(null, new Object[] { });
+
+ Class ProxyHandler = Class.forName("sun.plugin.protocol.ProxyHandler");
+ Method getProxyInfo = ProxyHandler.getMethod("getProxyInfo", new Class[] { URL.class });
+ Object proxyInfo = getProxyInfo.invoke(proxyHandler, new Object[] { new URL("http://www.xwt.org") });
+
+ Class ProxyInfo = Class.forName("sun.plugin.protocol.ProxyInfo");
+
+ if (((Boolean)ProxyInfo.getMethod("isSocksUsed", new Class[] { }).invoke(proxyInfo, new Object[] { })).booleanValue()) {
+ pi.socksProxyHost =
+ (String)ProxyInfo.getMethod("getSocksProxy", new Class[] { }).invoke(proxyInfo, new Object[] { });
+ pi.socksProxyPort =
+ ((Integer)ProxyInfo.getMethod("getSocksPort", new Class[] { }).invoke(proxyInfo, new Object[] { })).intValue();
+ }
+
+ if (((Boolean)ProxyInfo.getMethod("isProxyUsed", new Class[] { }).invoke(proxyInfo, new Object[] { })).booleanValue()) {
+ pi.httpProxyHost =
+ (String)ProxyInfo.getMethod("getProxy", new Class[] { }).invoke(proxyInfo, new Object[] { });
+ pi.httpProxyPort =
+ ((Integer)ProxyInfo.getMethod("getPort", new Class[] { }).invoke(proxyInfo, new Object[] { })).intValue();
+ }
+
+ if (pi.httpProxyHost != null || pi.socksProxyHost != null) return pi;
+ else return null;
+
+ } catch (Throwable e) {
+ if (Log.on) Log.log(this, "exception while querying sun.plugin.protocol.PluginProxyHandler: " + e);
+ return null;
+ }
+ }});
+ }
+
+ protected Socket __getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException {
+ return super._getSocket(host, port, ssl, negotiate);
+ }
+ protected Socket _getSocket(final String host, final int port, final boolean ssl, final boolean negotiate) throws IOException {