<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Java-To-JavaScript Considerations</title><link>https://sourceforge.net/p/swingjs/wiki/Java-To-JavaScript%2520Considerations/</link><description>Recent changes to Java-To-JavaScript Considerations</description><atom:link href="https://sourceforge.net/p/swingjs/wiki/Java-To-JavaScript%20Considerations/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 11 Jun 2015 13:58:44 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/swingjs/wiki/Java-To-JavaScript%20Considerations/feed" rel="self" type="application/rss+xml"/><item><title>Java-To-JavaScript Considerations modified by Bob Hanson</title><link>https://sourceforge.net/p/swingjs/wiki/Java-To-JavaScript%2520Considerations/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -6,7 +6,7 @@

 # J2S Native Block

-J2S allows documentation-block code annotations to replace snippets of Java code with raw JavaScript when compiling. These are set off usingthe @j2sNative annotation:
+J2S allows documentation-block code annotations to replace snippets of Java code with raw JavaScript when compiling. These are set off using the @j2sNative annotation:

 ~~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bob Hanson</dc:creator><pubDate>Thu, 11 Jun 2015 13:58:44 -0000</pubDate><guid>https://sourceforge.neta8c60e22f4a0e64d8018a64e2d78027ea9e7e187</guid></item><item><title>Java-To-JavaScript Considerations modified by Bob Hanson</title><link>https://sourceforge.net/p/swingjs/wiki/Java-To-JavaScript%2520Considerations/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -54,286 +54,6 @@
 ~~~~~

 then "return(jQuery)" will always be kept as a single unit.
-
-#J2S bugs
-
-Not surprisingly, there are some bugs in the J2S compiler. These can be worked around with a bit of Java refactoring and style adjustment. 
-
- 
-##1 forced typing in method signatures
-
-The J2S compiler does not have support for proper method signature handling in cases such as:
-
-~~~~~
-  new URL((URL) null, filePath, null)
-~~~~~
-  
-where the forced typing of null indicates which overloaded method to invoke. The issue here is that without "(URL)" the call is ambiguous. 
-However, there is a flaw in j2slib (jmolj2s) in that the called 
-method receives a "null" URL object, which does not in JavaScript
-evaluate to true for "== null". Thus, testing for null within 
-functions called this way process improperly.
-
-For example, in javax.swing.RepaintManager:
-
-~~~~~
-   public static RepaintManager currentManager(JComponent c) {
-       return currentManager((Component) c);
-   }
-~~~~~
-
-This causes an infinite loop.
-
-##2 multi-level empty array declarations
-
-array declarations 
-
-~~~~~
- int[][] a = new int[3][]
-~~~~~
- 
- and
- 
-~~~~~
- int[] a = new int[3]
-~~~~~
- 
- are treated the same. The first needs to be changed to javajs.util.AU.newInt2(3)
- Several similar methods are in javajs.util.AU
- 
-##3 inner class variable renaming
-
-The J2S compiler changes the variable names in inner classes variables to a b c d..., making it
-nearly impossible to insert @j2sNative blocks. As much as possible, remove inner classes, and if they are necessary, make sure they call methods in their outer classes if @j2sNative is used.
-
-##4 calling ResourceBundle
-
-J2S supports run-time loading of resource bundles, but there is a bug in that implementation by the compiler. 
-
-~~~~~
-@J2SRequireImport({jsjava.util.PropertyResourceBundle.class})
-~~~~~
-
-is required for  public abstract class ResourceBundle because the inner class
-ResourceBundle.Control requires it, but for some reason it is not included in the
-MUST list in the Clazz.load() call.
-
-##5 HashMap oddity
-
-for some reason HashMap cannot call its superclass (AbstractMap) "putall" method from its constructor.
-
-  
-##6 inner class constructors lost
-
-J2S drops seemingly unnecessary constructors in inner classes. These
-are required, and must be included. I added j2sNative blocks to do this.
-
-~~~~~
-public class Gregorian extends BaseCalendar {
-
-    static class Date extends BaseCalendar.Date {
-      protected Date() {
-        super();
-        /**
-         * @j2sNative
-         */
-        {
-       int dummy = 1; // forces J2S to leave this in
-        }
-    }
-
-    protected Date(TimeZone zone) {
-        super(zone);
-        /**
-         * @j2sNative
-         */
-        {
-       int dummy = 1; // forces J2S to leave this in
-        }
-    }
-
-  ...
-~~~~~
-
-##7 integer i /= n does not work
-
-J2S does not properly do integer/long/short/byte  /=
-
-~~~~~
-  n /= 3
-~~~~~
-  
-needs to be written out as
-
-~~~~~
-  n = n / 3
-~~~~~
-  
-   
-##8 class-instantiation may not load required classes properly
-
-There are times where J2S does not execute initialization in the proper order
-when constructing subclasses. The problem is only occasionally seen, and it always
-occurs when "new" is used in a class outside of methods. Usually this is fine, but
-it can result in problems.  
-
-For example, in the creation of JApplet, the ArrayList&amp;lt;Container&amp;gt;.component constructor 
-was cleared in Clazz.prepareFields for Container AFTER it was
-used in the constructor for JApplet. 
-
-The way around this is to not instantiate Objects in-line:
-
-~~~~~
-public class Container
-...
-   List&amp;lt;Component&amp;gt; component =  new ArrayList();
-...
-~~~~~
-
-but instead put that in the constructor.
-
-~~~~~
-public class Container
-...
-   List&amp;lt;Component&amp;gt; component;
-...
-public Container () {
-   component =  new ArrayList();
-}
-~~~~~
-
-   
-##9 arrays with no elements cannot be typed
-
-array.getClass() returns "array" -- there is no way to determine the class of an array
-   if it has no elements. However a work-around is to use
-   
-~~~~~
-     java.lang.reflect.Array.newInstance(xxxx.class, n)
-~~~~~
-     
-   which I have adjusted to allow for testing using .getClass().getComponentType() 
-
-##10  Inner classes must not call other inner classes defined after them in a file.
-
-    This showed up in java.awt.geom.Path2D.Float.CopyIterator, which extends
-    java.awt.geom.Path2D.Iterator. Since the Iterator is in the code after CopyIterator,
-    the reference to java.awt.geom.Path2D.Iterator in
-    
-~~~~~
-    c$ = Clazz.decorateAsClass (function () {
-       this.floatCoords = null;
-       Clazz.instantialize (this, arguments);
-   }, java.awt.geom.Path2D.Float, "CopyIterator", java.awt.geom.Path2D.Iterator);
-~~~~~
-     
-    is null, and then CopyIterator does not extend Iterator.
-
-Solution is to make sure inner subclasses only extend other inner subclasses that are already defined in the file.
-      
-##11 instanceof can fail for local anonymous class definitions
-
-
-in javax.swing.JSlider we have
-
-~~~~~
-  ...
-    public Hashtable createStandardLabels( int increment, int start ) {
-      ...
-        class SmartHashtable extends Hashtable implements PropertyChangeListener {
-           ...
-            class LabelUIResource extends JLabel implements UIResource {
-               ...
-            }
-            ...
-            public void propertyChange( PropertyChangeEvent e ) {
-               ...
-
-                        if ( !(value instanceof LabelUIResource) ) {
-                            hashtable.put( key, value );
-                        }
-                    }
-                    
-               ...
-            }
-                  
-~~~~~
-  but  for that last if check, we see in the JavaScript:
-  
-~~~~~
-    if (!(Clazz.instanceOf (e, ))) {
-      d.put (c, e);
-    }
-~~~~~
-  
-  where "LabelUIResource" is missing. This can be fixed by moving both of these inner classes to inside the overall class, but not inside a method.
-  
-
-##12 use of "new" static blocks may require explicit import
-
-
-In java.awt.image.Raster, we have a static block that 
-creates new SinglePixelPackedSampleModel, IntegerInterleavedRaster, and ByteInterleavedRaster objects. In that case, we needed to add @J2SRequireImport annotations in order to force J2S to load those classes prior to loading this class.
-      
-~~~~~
-      @J2SRequireImport({ jsjava.awt.image.SinglePixelPackedSampleModel.class,    jssun.awt.image.IntegerInterleavedRaster.class, jssun.awt.image.ByteInterleavedRaster.class })
-~~~~~
-      
-      
-##13 A subclass cannot have the same constructor signature as a superclass except for 
-a parameter of its class:
-
-~~~~~
-public IntegerComponentRaster extends SunWriteableRaster {
-   public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
-           Rectangle aRegion, Point origin, Raster parent) {
-            super(sampleModel, dataBuffer, aRegion, origin, parent);
-            ...
-        }
-           
-public SunWriteableRaster extends WriteableRaster {
-   public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
-           Rectangle aRegion, Point origin, SunWriteableRaster parent) {
-            super(sampleModel, dataBuffer, aRegion, origin, parent);
-            ...
-        }
-        
-~~~~~
-           
-Notice how the signature changes in the last parameter, even though it is really the same signature. This results in an infinite loop.
-           
-Solution: there is no need for this; just make all references to the superclass:
-
-~~~~~
-   public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
-           Rectangle aRegion, Point origin, Raster parent) {
-            super(sampleModel, dataBuffer, aRegion, origin, parent);
-            ...
-        }
-~~~~~
-           
- 
-##14 inner classes required by instanceof may not be loaded
-
-J2S should not require loading a class just because it is the target of instanceof. If a class has not been loaded, nothing cannot be an instance of that class.
-
-In any case, when an inner public class is called by another class using instanceof, that inner class becomes an "optional" load. But optional loads must still be loaded, and unless declared in package.js, J2S will look for xxx.xxx.Outer/Inner.js because the inner classes are not fully declared. For example,
-
-~~~~~
-   NumberFormat.Field x = new NumberFormat.Field();
-~~~~~
-
-in an inner class is going to cause the j2sLib to look for NumberFormat.Field. But unless NumberFormat has been loaded, NumberFormat.Field will not be found, because J2S will look for it in NumberFormat/Field.js, not NumberFormat.js.
-
-Solution is to switch to requiring the outer class, not the inner class:
-
-~~~~~
-@J2SRequireImport(NumberFormat.class)
-@J2SIgnoreImport(NumberFormat.Field.class)
-public class NumberFormatter extends InternationalFormatter...
-~~~~~
-  
-

 # MINOR ISSUES--requiring no rewriting
@@ -799,3 +519,283 @@

+#J2S bugs
+
+Not surprisingly, there are some bugs in the J2S compiler. These can be worked around with a bit of Java refactoring and style adjustment. 
+
+ 
+##1 forced typing in method signatures
+
+The J2S compiler does not have support for proper method signature handling in cases such as:
+
+~~~~~
+  new URL((URL) null, filePath, null)
+~~~~~
+  
+where the forced typing of null indicates which overloaded method to invoke. The issue here is that without "(URL)" the call is ambiguous. 
+However, there is a flaw in j2slib (jmolj2s) in that the called 
+method receives a "null" URL object, which does not in JavaScript
+evaluate to true for "== null". Thus, testing for null within 
+functions called this way process improperly.
+
+For example, in javax.swing.RepaintManager:
+
+~~~~~
+   public static RepaintManager currentManager(JComponent c) {
+       return currentManager((Component) c);
+   }
+~~~~~
+
+This causes an infinite loop.
+
+##2 multi-level empty array declarations
+
+array declarations 
+
+~~~~~
+ int[][] a = new int[3][]
+~~~~~
+ 
+ and
+ 
+~~~~~
+ int[] a = new int[3]
+~~~~~
+ 
+ are treated the same. The first needs to be changed to javajs.util.AU.newInt2(3)
+ Several similar methods are in javajs.util.AU
+ 
+##3 inner class variable renaming
+
+The J2S compiler changes the variable names in inner classes variables to a b c d..., making it
+nearly impossible to insert @j2sNative blocks. As much as possible, remove inner classes, and if they are necessary, make sure they call methods in their outer classes if @j2sNative is used.
+
+##4 calling ResourceBundle
+
+J2S supports run-time loading of resource bundles, but there is a bug in that implementation by the compiler. 
+
+~~~~~
+@J2SRequireImport({jsjava.util.PropertyResourceBundle.class})
+~~~~~
+
+is required for  public abstract class ResourceBundle because the inner class
+ResourceBundle.Control requires it, but for some reason it is not included in the
+MUST list in the Clazz.load() call.
+
+##5 HashMap oddity
+
+for some reason HashMap cannot call its superclass (AbstractMap) "putall" method from its constructor.
+
+  
+##6 inner class constructors lost
+
+J2S drops seemingly unnecessary constructors in inner classes. These
+are required, and must be included. I added j2sNative blocks to do this.
+
+~~~~~
+public class Gregorian extends BaseCalendar {
+
+    static class Date extends BaseCalendar.Date {
+      protected Date() {
+        super();
+        /**
+         * @j2sNative
+         */
+        {
+       int dummy = 1; // forces J2S to leave this in
+        }
+    }
+
+    protected Date(TimeZone zone) {
+        super(zone);
+        /**
+         * @j2sNative
+         */
+        {
+       int dummy = 1; // forces J2S to leave this in
+        }
+    }
+
+  ...
+~~~~~
+
+##7 integer i /= n does not work
+
+J2S does not properly do integer/long/short/byte  /=
+
+~~~~~
+  n /= 3
+~~~~~
+  
+needs to be written out as
+
+~~~~~
+  n = n / 3
+~~~~~
+  
+   
+##8 class-instantiation may not load required classes properly
+
+There are times where J2S does not execute initialization in the proper order
+when constructing subclasses. The problem is only occasionally seen, and it always
+occurs when "new" is used in a class outside of methods. Usually this is fine, but
+it can result in problems.  
+
+For example, in the creation of JApplet, the ArrayList&amp;lt;Container&amp;gt;.component constructor 
+was cleared in Clazz.prepareFields for Container AFTER it was
+used in the constructor for JApplet. 
+
+The way around this is to not instantiate Objects in-line:
+
+~~~~~
+public class Container
+...
+   List&amp;lt;Component&amp;gt; component =  new ArrayList();
+...
+~~~~~
+
+but instead put that in the constructor.
+
+~~~~~
+public class Container
+...
+   List&amp;lt;Component&amp;gt; component;
+...
+public Container () {
+   component =  new ArrayList();
+}
+~~~~~
+
+   
+##9 arrays with no elements cannot be typed
+
+array.getClass() returns "array" -- there is no way to determine the class of an array
+   if it has no elements. However a work-around is to use
+   
+~~~~~
+     java.lang.reflect.Array.newInstance(xxxx.class, n)
+~~~~~
+     
+   which I have adjusted to allow for testing using .getClass().getComponentType() 
+
+##10  Inner classes must not call other inner classes defined after them in a file.
+
+    This showed up in java.awt.geom.Path2D.Float.CopyIterator, which extends
+    java.awt.geom.Path2D.Iterator. Since the Iterator is in the code after CopyIterator,
+    the reference to java.awt.geom.Path2D.Iterator in
+    
+~~~~~
+    c$ = Clazz.decorateAsClass (function () {
+       this.floatCoords = null;
+       Clazz.instantialize (this, arguments);
+   }, java.awt.geom.Path2D.Float, "CopyIterator", java.awt.geom.Path2D.Iterator);
+~~~~~
+     
+    is null, and then CopyIterator does not extend Iterator.
+
+Solution is to make sure inner subclasses only extend other inner subclasses that are already defined in the file.
+      
+##11 instanceof can fail for local anonymous class definitions
+
+
+in javax.swing.JSlider we have
+
+~~~~~
+  ...
+    public Hashtable createStandardLabels( int increment, int start ) {
+      ...
+        class SmartHashtable extends Hashtable implements PropertyChangeListener {
+           ...
+            class LabelUIResource extends JLabel implements UIResource {
+               ...
+            }
+            ...
+            public void propertyChange( PropertyChangeEvent e ) {
+               ...
+
+                        if ( !(value instanceof LabelUIResource) ) {
+                            hashtable.put( key, value );
+                        }
+                    }
+                    
+               ...
+            }
+                  
+~~~~~
+  but  for that last if check, we see in the JavaScript:
+  
+~~~~~
+    if (!(Clazz.instanceOf (e, ))) {
+      d.put (c, e);
+    }
+~~~~~
+  
+  where "LabelUIResource" is missing. This can be fixed by moving both of these inner classes to inside the overall class, but not inside a method.
+  
+
+##12 use of "new" static blocks may require explicit import
+
+
+In java.awt.image.Raster, we have a static block that 
+creates new SinglePixelPackedSampleModel, IntegerInterleavedRaster, and ByteInterleavedRaster objects. In that case, we needed to add @J2SRequireImport annotations in order to force J2S to load those classes prior to loading this class.
+      
+~~~~~
+      @J2SRequireImport({ jsjava.awt.image.SinglePixelPackedSampleModel.class,    jssun.awt.image.IntegerInterleavedRaster.class, jssun.awt.image.ByteInterleavedRaster.class })
+~~~~~
+      
+      
+##13 A subclass cannot have the same constructor signature as a superclass except for 
+a parameter of its class:
+
+~~~~~
+public IntegerComponentRaster extends SunWriteableRaster {
+   public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
+           Rectangle aRegion, Point origin, Raster parent) {
+            super(sampleModel, dataBuffer, aRegion, origin, parent);
+            ...
+        }
+           
+public SunWriteableRaster extends WriteableRaster {
+   public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
+           Rectangle aRegion, Point origin, SunWriteableRaster parent) {
+            super(sampleModel, dataBuffer, aRegion, origin, parent);
+            ...
+        }
+        
+~~~~~
+           
+Notice how the signature changes in the last parameter, even though it is really the same signature. This results in an infinite loop.
+           
+Solution: there is no need for this; just make all references to the superclass:
+
+~~~~~
+   public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
+           Rectangle aRegion, Point origin, Raster parent) {
+            super(sampleModel, dataBuffer, aRegion, origin, parent);
+            ...
+        }
+~~~~~
+           
+ 
+##14 inner classes required by instanceof may not be loaded
+
+J2S should not require loading a class just because it is the target of instanceof. If a class has not been loaded, nothing cannot be an instance of that class.
+
+In any case, when an inner public class is called by another class using instanceof, that inner class becomes an "optional" load. But optional loads must still be loaded, and unless declared in package.js, J2S will look for xxx.xxx.Outer/Inner.js because the inner classes are not fully declared. For example,
+
+~~~~~
+   NumberFormat.Field x = new NumberFormat.Field();
+~~~~~
+
+in an inner class is going to cause the j2sLib to look for NumberFormat.Field. But unless NumberFormat has been loaded, NumberFormat.Field will not be found, because J2S will look for it in NumberFormat/Field.js, not NumberFormat.js.
+
+Solution is to switch to requiring the outer class, not the inner class:
+
+~~~~~
+@J2SRequireImport(NumberFormat.class)
+@J2SIgnoreImport(NumberFormat.Field.class)
+public class NumberFormatter extends InternationalFormatter...
+~~~~~
+  
+
+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bob Hanson</dc:creator><pubDate>Thu, 11 Jun 2015 13:55:29 -0000</pubDate><guid>https://sourceforge.net7d1649f813d66504dc93ed71db20f204668c8178</guid></item><item><title>Java-To-JavaScript Considerations modified by Bob Hanson</title><link>https://sourceforge.net/p/swingjs/wiki/Java-To-JavaScript%2520Considerations/</link><description>&lt;div class="markdown_content"&gt;&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#introduction"&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#j2s-native-block"&gt;J2S Native Block&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#j2s-bugs"&gt;J2S bugs&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#1-forced-typing-in-method-signatures"&gt;1 forced typing in method signatures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#2-multi-level-empty-array-declarations"&gt;2 multi-level empty array declarations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#3-inner-class-variable-renaming"&gt;3 inner class variable renaming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#4-calling-resourcebundle"&gt;4 calling ResourceBundle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#5-hashmap-oddity"&gt;5 HashMap oddity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#6-inner-class-constructors-lost"&gt;6 inner class constructors lost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#7-integer-i-n-does-not-work"&gt;7 integer i /= n does not work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#8-class-instantiation-may-not-load-required-classes-properly"&gt;8 class-instantiation may not load required classes properly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#9-arrays-with-no-elements-cannot-be-typed"&gt;9 arrays with no elements cannot be typed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#10-inner-classes-must-not-call-other-inner-classes-defined-after-them-in-a-file"&gt;10  Inner classes must not call other inner classes defined after them in a file.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#11-instanceof-can-fail-for-local-anonymous-class-definitions"&gt;11 instanceof can fail for local anonymous class definitions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#12-use-of-new-static-blocks-may-require-explicit-import"&gt;12 use of "new" static blocks may require explicit import&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#13-a-subclass-cannot-have-the-same-constructor-signature-as-a-superclass-except-for"&gt;13 A subclass cannot have the same constructor signature as a superclass except for&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#14-inner-classes-required-by-instanceof-may-not-be-loaded"&gt;14 inner classes required by instanceof may not be loaded&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#minor-issues-requiring-no-rewriting"&gt;MINOR ISSUES--requiring no rewriting&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#accessibility"&gt;accessibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#security"&gt;security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#serialization"&gt;serialization&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#minor-issues-requiring-some-rewritingrefactoring-by-bob-and-udo"&gt;MINOR ISSUES--requiring some rewriting/refactoring by Bob and Udo&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#javautilbitset-must-be-16-bit"&gt;java.util.BitSet must be 16-bit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#bit-wise-operations-force-int"&gt;bit-wise operations force int&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#threadcurrentthread-dispatchthread"&gt;Thread.currentThread() == dispatchThread&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#minor-issues-requiring-some-rewritingrefactoring-outside-of-swingjs"&gt;MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#lookandfeel"&gt;LookAndFeel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#primitive-numerical-types"&gt;primitive numerical types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#distinguishing-arrays"&gt;distinguishing arrays&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#forced-null-typing"&gt;forced null typing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#native-classes"&gt;native classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#javaawtcolor"&gt;java.awt.Color&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#javaxswingjfiledialog"&gt;javax.swing.JFileDialog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#key-focus"&gt;key focus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#static-methods-and-classes-order-is-important"&gt;static methods and classes -- order is important&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#inner-class-order"&gt;inner class order&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#major-issues-for-bob-and-udo-within-swingjs"&gt;MAJOR ISSUES--for Bob and Udo within SwingJS&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#fonts"&gt;fonts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#os-dependent-classes"&gt;OS-dependent classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#awt-component-peers"&gt;AWT component peers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#major-issues-to-be-resolved-by-implementers"&gt;MAJOR ISSUES--to be resolved by implementers&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#fonts_1"&gt;fonts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#specific-awt-components-not-implemented"&gt;specific AWT components not implemented&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#threads"&gt;threads&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#image-loading"&gt;image loading&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#no-biginteger-no-bigdecimal"&gt;no BigInteger; no BigDecimal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#no-format-internationalization"&gt;no format internationalization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#text-related-field-implementation"&gt;text-related field implementation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h1 id="introduction"&gt;Introduction&lt;/h1&gt;
&lt;p&gt;This document addresses Java design that optimizes success in working with J2S. This implementation of J2S involves use of the jQuery and JSmol JavaScript libraries. All such required library code is included in this project's source code. (see jsmoljs/). The standard jQuery library (10.4+) can be used, but that has been extended to work with binary file transfer (see jsmoljs/JSmoljQueryExt.js). In addition, the required J2S Eclipse plug-in is in the project code under j2s/eclipse-plugin. &lt;/p&gt;
&lt;h1 id="j2s-native-block"&gt;J2S Native Block&lt;/h1&gt;
&lt;p&gt;J2S allows documentation-block code annotations to replace snippets of Java code with raw JavaScript when compiling. These are set off usingthe @j2sNative annotation:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        /**
         * @j2sNative
         * 
         *  jQuery.$ || (jQuery.$ = jQuery);  return jQuery;
         */
                {
                  &amp;lt;replaced Java code here&amp;gt;
                }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Critical (and annoyingly easy to forget) is the necessary { ... } block after the j2sNative block. If that is left out, no replacement is made.&lt;/p&gt;
&lt;p&gt;If &lt;b&gt;return&lt;/b&gt; is used in this JavaScript, it is recommended to always use "return(xxx)" with no space between "return" and "(". Otherwise, when Eclipse reformatting is carried out using ALT-S-N or Alt-S-F it is possible to have something like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        /**
         * @j2sNative
         * 
         *  jQuery.$ || (jQuery.$ = jQuery);  return jQuery;
         */
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;turn into this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        /**
         * @j2sNative
         * 
         *           jQuery.$ || (jQuery.$ = jQuery);  return
         *           jQuery;
         */
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which will fail. But if we have&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        /**
         * @j2sNative
         * 
         *           jQuery.$ || (jQuery.$ = jQuery);  return(jQuery);
         */
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;then "return(jQuery)" will always be kept as a single unit.&lt;/p&gt;
&lt;h1 id="j2s-bugs"&gt;J2S bugs&lt;/h1&gt;
&lt;p&gt;Not surprisingly, there are some bugs in the J2S compiler. These can be worked around with a bit of Java refactoring and style adjustment. &lt;/p&gt;
&lt;h2 id="1-forced-typing-in-method-signatures"&gt;1 forced typing in method signatures&lt;/h2&gt;
&lt;p&gt;The J2S compiler does not have support for proper method signature handling in cases such as:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  new URL((URL) null, filePath, null)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where the forced typing of null indicates which overloaded method to invoke. The issue here is that without "(URL)" the call is ambiguous. &lt;br /&gt;
However, there is a flaw in j2slib (jmolj2s) in that the called &lt;br /&gt;
method receives a "null" URL object, which does not in JavaScript&lt;br /&gt;
evaluate to true for "== null". Thus, testing for null within &lt;br /&gt;
functions called this way process improperly.&lt;/p&gt;
&lt;p&gt;For example, in javax.swing.RepaintManager:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    public static RepaintManager currentManager(JComponent c) {
        return currentManager((Component) c);
    }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This causes an infinite loop.&lt;/p&gt;
&lt;h2 id="2-multi-level-empty-array-declarations"&gt;2 multi-level empty array declarations&lt;/h2&gt;
&lt;p&gt;array declarations &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt; int[][] a = new int[3][]
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt; int[] a = new int[3]
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;are treated the same. The first needs to be changed to javajs.util.AU.newInt2(3)&lt;br /&gt;
 Several similar methods are in javajs.util.AU&lt;/p&gt;
&lt;h2 id="3-inner-class-variable-renaming"&gt;3 inner class variable renaming&lt;/h2&gt;
&lt;p&gt;The J2S compiler changes the variable names in inner classes variables to a b c d..., making it&lt;br /&gt;
nearly impossible to insert @j2sNative blocks. As much as possible, remove inner classes, and if they are necessary, make sure they call methods in their outer classes if @j2sNative is used.&lt;/p&gt;
&lt;h2 id="4-calling-resourcebundle"&gt;4 calling ResourceBundle&lt;/h2&gt;
&lt;p&gt;J2S supports run-time loading of resource bundles, but there is a bug in that implementation by the compiler. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;@J2SRequireImport({jsjava.util.PropertyResourceBundle.class})
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is required for  public abstract class ResourceBundle because the inner class&lt;br /&gt;
ResourceBundle.Control requires it, but for some reason it is not included in the&lt;br /&gt;
MUST list in the Clazz.load() call.&lt;/p&gt;
&lt;h2 id="5-hashmap-oddity"&gt;5 HashMap oddity&lt;/h2&gt;
&lt;p&gt;for some reason HashMap cannot call its superclass (AbstractMap) "putall" method from its constructor.&lt;/p&gt;
&lt;h2 id="6-inner-class-constructors-lost"&gt;6 inner class constructors lost&lt;/h2&gt;
&lt;p&gt;J2S drops seemingly unnecessary constructors in inner classes. These&lt;br /&gt;
are required, and must be included. I added j2sNative blocks to do this.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;public class Gregorian extends BaseCalendar {

    static class Date extends BaseCalendar.Date {
      protected Date() {
        super();
        /**
         * @j2sNative
         */
        {
        int dummy = 1; // forces J2S to leave this in
        }
    }

    protected Date(TimeZone zone) {
        super(zone);
        /**
         * @j2sNative
         */
        {
        int dummy = 1; // forces J2S to leave this in
        }
    }

  ...
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="7-integer-i-n-does-not-work"&gt;7 integer i /= n does not work&lt;/h2&gt;
&lt;p&gt;J2S does not properly do integer/long/short/byte  /=&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  n /= 3
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;needs to be written out as&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  n = n / 3
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="8-class-instantiation-may-not-load-required-classes-properly"&gt;8 class-instantiation may not load required classes properly&lt;/h2&gt;
&lt;p&gt;There are times where J2S does not execute initialization in the proper order&lt;br /&gt;
when constructing subclasses. The problem is only occasionally seen, and it always&lt;br /&gt;
occurs when "new" is used in a class outside of methods. Usually this is fine, but&lt;br /&gt;
it can result in problems.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;For example, in the creation of JApplet, the ArrayList&amp;lt;Container&amp;gt;.component constructor &lt;br /&gt;
was cleared in Clazz.prepareFields for Container AFTER it was&lt;br /&gt;
used in the constructor for JApplet. &lt;/p&gt;
&lt;p&gt;The way around this is to not instantiate Objects in-line:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;public class Container
...
   List&amp;lt;Component&amp;gt; component =  new ArrayList();
...
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;but instead put that in the constructor.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;public class Container
...
   List&amp;lt;Component&amp;gt; component;
...
public Container () {
   component =  new ArrayList();
}
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="9-arrays-with-no-elements-cannot-be-typed"&gt;9 arrays with no elements cannot be typed&lt;/h2&gt;
&lt;p&gt;array.getClass() returns "array" -- there is no way to determine the class of an array&lt;br /&gt;
   if it has no elements. However a work-around is to use&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;     java.lang.reflect.Array.newInstance(xxxx.class, n)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which I have adjusted to allow for testing using .getClass().getComponentType() &lt;/p&gt;
&lt;h2 id="10-inner-classes-must-not-call-other-inner-classes-defined-after-them-in-a-file"&gt;10  Inner classes must not call other inner classes defined after them in a file.&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;showed&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CopyIterator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;which&lt;/span&gt; &lt;span class="kr"&gt;extends&lt;/span&gt;
&lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Iterator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Since&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;Iterator&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="nx"&gt;after&lt;/span&gt; &lt;span class="nx"&gt;CopyIterator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;reference&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Iterator&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;

    &lt;span class="nx"&gt;c$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Clazz&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;decorateAsClass&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floatCoords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;Clazz&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instantialize&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"CopyIterator"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Iterator&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;then&lt;/span&gt; &lt;span class="nx"&gt;CopyIterator&lt;/span&gt; &lt;span class="nx"&gt;does&lt;/span&gt; &lt;span class="nx"&gt;not&lt;/span&gt; &lt;span class="nx"&gt;extend&lt;/span&gt; &lt;span class="nx"&gt;Iterator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Solution is to make sure inner subclasses only extend other inner subclasses that are already defined in the file.&lt;/p&gt;
&lt;h2 id="11-instanceof-can-fail-for-local-anonymous-class-definitions"&gt;11 instanceof can fail for local anonymous class definitions&lt;/h2&gt;
&lt;p&gt;in javax.swing.JSlider we have&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  ...
    public Hashtable createStandardLabels( int increment, int start ) {
      ...
        class SmartHashtable extends Hashtable implements PropertyChangeListener {
           ...
            class LabelUIResource extends JLabel implements UIResource {
               ...
            }
            ...
            public void propertyChange( PropertyChangeEvent e ) {
               ...

                        if ( !(value instanceof LabelUIResource) ) {
                            hashtable.put( key, value );
                        }
                    }

               ...
            }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;but  for that last if check, we see in the JavaScript:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    if (!(Clazz.instanceOf (e, ))) {
      d.put (c, e);
    }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where "LabelUIResource" is missing. This can be fixed by moving both of these inner classes to inside the overall class, but not inside a method.&lt;/p&gt;
&lt;h2 id="12-use-of-new-static-blocks-may-require-explicit-import"&gt;12 use of "new" static blocks may require explicit import&lt;/h2&gt;
&lt;p&gt;In java.awt.image.Raster, we have a static block that &lt;br /&gt;
creates new SinglePixelPackedSampleModel, IntegerInterleavedRaster, and ByteInterleavedRaster objects. In that case, we needed to add @J2SRequireImport annotations in order to force J2S to load those classes prior to loading this class.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;      @J2SRequireImport({ jsjava.awt.image.SinglePixelPackedSampleModel.class,    jssun.awt.image.IntegerInterleavedRaster.class, jssun.awt.image.ByteInterleavedRaster.class })
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="13-a-subclass-cannot-have-the-same-constructor-signature-as-a-superclass-except-for"&gt;13 A subclass cannot have the same constructor signature as a superclass except for&lt;/h2&gt;
&lt;p&gt;a parameter of its class:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;public IntegerComponentRaster extends SunWriteableRaster {
    public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
            Rectangle aRegion, Point origin, Raster parent) {
            super(sampleModel, dataBuffer, aRegion, origin, parent);
            ...
        }

public SunWriteableRaster extends WriteableRaster {
    public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
            Rectangle aRegion, Point origin, SunWriteableRaster parent) {
            super(sampleModel, dataBuffer, aRegion, origin, parent);
            ...
        }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notice how the signature changes in the last parameter, even though it is really the same signature. This results in an infinite loop.&lt;/p&gt;
&lt;p&gt;Solution: there is no need for this; just make all references to the superclass:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    public IntegerComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer,
            Rectangle aRegion, Point origin, Raster parent) {
            super(sampleModel, dataBuffer, aRegion, origin, parent);
            ...
        }
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="14-inner-classes-required-by-instanceof-may-not-be-loaded"&gt;14 inner classes required by instanceof may not be loaded&lt;/h2&gt;
&lt;p&gt;J2S should not require loading a class just because it is the target of instanceof. If a class has not been loaded, nothing cannot be an instance of that class.&lt;/p&gt;
&lt;p&gt;In any case, when an inner public class is called by another class using instanceof, that inner class becomes an "optional" load. But optional loads must still be loaded, and unless declared in package.js, J2S will look for xxx.xxx.Outer/Inner.js because the inner classes are not fully declared. For example,&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;   NumberFormat.Field x = new NumberFormat.Field();
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;in an inner class is going to cause the j2sLib to look for NumberFormat.Field. But unless NumberFormat has been loaded, NumberFormat.Field will not be found, because J2S will look for it in NumberFormat/Field.js, not NumberFormat.js.&lt;/p&gt;
&lt;p&gt;Solution is to switch to requiring the outer class, not the inner class:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;@J2SRequireImport(NumberFormat.class)
@J2SIgnoreImport(NumberFormat.Field.class)
public class NumberFormatter extends InternationalFormatter...
&lt;/pre&gt;&lt;/div&gt;
&lt;h1 id="minor-issues-requiring-no-rewriting"&gt;MINOR ISSUES--requiring no rewriting&lt;/h1&gt;
&lt;h2 id="accessibility"&gt;accessibility&lt;/h2&gt;
&lt;p&gt;All Accessibility handling has been commented out to save the download footprint.&lt;br /&gt;
This removes the need for sun.misc.SharedSecrets&lt;/p&gt;
&lt;h2 id="security"&gt;security&lt;/h2&gt;
&lt;p&gt;All JavaScript security is handled by the browser natively. &lt;br /&gt;
Thus, Java security checking is no longer necessary, and &lt;br /&gt;
java.security.AccessController has been simplified to work without&lt;br /&gt;
native security checking.&lt;/p&gt;
&lt;h2 id="serialization"&gt;serialization&lt;/h2&gt;
&lt;p&gt;All serialization has been removed. It was never very useful for Swing anyway, &lt;br /&gt;
because one needs exactly the same Java version to save and restore serialized objects.&lt;/p&gt;
&lt;h1 id="minor-issues-requiring-some-rewritingrefactoring-by-bob-and-udo"&gt;MINOR ISSUES--requiring some rewriting/refactoring by Bob and Udo&lt;/h1&gt;
&lt;h2 id="javautilbitset-must-be-16-bit"&gt;java.util.BitSet must be 16-bit&lt;/h2&gt;
&lt;p&gt;Although JavaScript will support numerical values up to 2^54, &lt;br /&gt;
these "long" values are really doubles. So we use a 16-bit BitSet. For efficiency, javajs.util.BS is recommended. &lt;/p&gt;
&lt;h2 id="bit-wise-operations-force-int"&gt;bit-wise operations force int&lt;/h2&gt;
&lt;p&gt;Bit-wise &amp;amp;, |, and !, &amp;lt;&amp;lt;, etc. on values greater than 2^30 do not give the &lt;br /&gt;
expected results because integer bit-wise operation is used. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;Math.pow(2,31)
2147483648
Math.pow(2,31)&amp;amp;Math.pow(2,31)
-2147483648
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="threadcurrentthread-dispatchthread"&gt;Thread.currentThread() == dispatchThread&lt;/h2&gt;
&lt;p&gt;recode to JSToolkit.isDispatchThread()&lt;/p&gt;
&lt;h1 id="minor-issues-requiring-some-rewritingrefactoring-outside-of-swingjs"&gt;MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS&lt;/h1&gt;
&lt;h2 id="lookandfeel"&gt;LookAndFeel&lt;/h2&gt;
&lt;p&gt;SwingJS implements the native browser LookAndFeel. Token UIManager methods are&lt;br /&gt;
present but unimplemented; methods returning key bindings or other arrays return null.&lt;/p&gt;
&lt;h2 id="primitive-numerical-types"&gt;primitive numerical types&lt;/h2&gt;
&lt;p&gt;JavaScript cannot distinguish among primitive number types &lt;br /&gt;
int, short, float, and double. Bob's J2S fix does allow for&lt;br /&gt;
distinguishing between int[] and float[], but that is all. &lt;br /&gt;
The implication is for overloaded methods and constructors.&lt;br /&gt;
For example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  Color(int r, int g, int b, int a)
  Color(float r, float g, float b, float a)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;cannot be distinguished. A very important case in this regard is &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  StringBuffer.append(int)
  StringBuffer.append(float)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There is no way to know one's intent here. Integers must be changed to strings:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  sb.append("" + i)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will need careful checking and will be the source of bugs, for sure,&lt;br /&gt;
because it is next to impossible to find all of these, and even if they are&lt;br /&gt;
found, certain cases such as above will never be perfectly resolved.&lt;/p&gt;
&lt;p&gt;In addition, JavaScript does not/cannot support "long". &lt;br /&gt;
One cannot test against Long.MAX_VALUE or Long.MIN_VALUE.&lt;/p&gt;
&lt;p&gt;Since int, long, byte, and char are not really integers, care must be taken &lt;br /&gt;
to avoid a loop such as the following, which was in java.text.DigitList:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  while (source &amp;gt; 0) {
    ... 
    source /= 10 
  }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Similarly, large integers will never roll over to negative ones. They will&lt;br /&gt;
just get bigger.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        int newLength = lineBuf.length * 2;
        /**
         * @j2sIgnore
         */
         {
            // never going to happen in JavaScript
            if (newLength &amp;lt; 0) {
              newLength = Integer.MAX_VALUE;
            }
         }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Also, J2S does not translate properly&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  int n = 110
  n /= 100
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This needs to be recast as&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  n = n / 100
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For example, SimpleDateFormat needs&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;month = Clazz.doubleToInt(month / 367);
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;instead of &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;month /= 367
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Because "-1" in JavaScript is not 0xFFFFFFFF one must take care to not compare a negative number with a 32-bit mask;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;(b &amp;amp; 0xFF000000) == 0xFF000000
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is true in Java for (int) b = -1, but is false in JavaScript, because 0xFF000000 is 4278190080, &lt;br /&gt;
while (-1 &amp;amp; 0xFF000000) is, strangely enough, -16777216, and, in fact, &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;(0xFF000000 &amp;amp; 0xFF000000) != 0xFF000000
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;because -16777216 is not 4278190080.&lt;/p&gt;
&lt;p&gt;One must compare similar operations:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;if ((b &amp;amp; 0xFF000000) == (0xFF000000 &amp;amp; 0xFF000000)) .....
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="distinguishing-arrays"&gt;distinguishing arrays&lt;/h2&gt;
&lt;p&gt;J2S cannot distinguish array types.&lt;br /&gt;
One cannot test:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  if (x instanceof float[]) {
  } else if (x instanceof double[]) {
  } else if (x instanceof Point2D[]) {
  }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The javajs.util.AU class does provide a set of tests for specific&lt;br /&gt;
kinds of arrays, but this is still not perfect, and it is not complete.&lt;br /&gt;
These methods call Clazz.isAxx methods and depend upon the first&lt;br /&gt;
inner-most array and, in some cases, inner-most array itself not being null.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  public static boolean isAB(Object x)     // byte[]
  public static boolean isAI(Object x)     // int[]
  public static boolean isAII(Object x)    // int[][]
  public static boolean isAF(Object x)     // float[]
  public static boolean isAFF(Object x)    // float[][]
  public static boolean isAFFF(Object x)   // float[][][]
  public static boolean isAD(Object x)     // double[]
  public static boolean isADD(Object x)    // double[][]

  public static boolean isAFloat(Object x) // Float[]
  public static boolean isAS(Object x)     // String[]
  public static boolean isASS(Object x)    // String[][]
  public static boolean isAP(Object x)     // javajs.util.T3[]
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="forced-null-typing"&gt;forced null typing&lt;/h2&gt;
&lt;p&gt;The J2S compiler has support for proper method signature handling &lt;br /&gt;
in cases such as:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  new URL((URL) null, filePath, null)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The issue here is that without that (URL) the call is ambiguous. &lt;br /&gt;
However, there is a flaw in j2slib (jmolj2s) in that the called &lt;br /&gt;
method receives a "null" URL object, which does not in JavaScript&lt;br /&gt;
evaluate to true for "== null". Thus, testing for null within &lt;br /&gt;
functions called this way process improperly.&lt;/p&gt;
&lt;h2 id="native-classes"&gt;native classes&lt;/h2&gt;
&lt;p&gt;There are no native classes. Any such class needs to be implemented in Java with or  without  calls to @j2sNative code.&lt;/p&gt;
&lt;p&gt;The J2S compiler ignores all static native method declarations.&lt;br /&gt;
Anything of this nature needs to be implemented in JavaScript if it is needed,&lt;br /&gt;
using j2sNative blocks:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cm"&gt;/**&lt;/span&gt;
&lt;span class="cm"&gt; * @j2sNative&lt;/span&gt;
&lt;span class="cm"&gt; *&lt;/span&gt;
&lt;span class="cm"&gt; */&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;it&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;critical&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;remember&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;insert&lt;span class="w"&gt; &lt;/span&gt;this&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;phrasing&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;or&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;block&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;be&lt;span class="w"&gt; &lt;/span&gt;ignored&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="javaawtcolor"&gt;java.awt.Color&lt;/h2&gt;
&lt;p&gt;See note under primitive types, above.&lt;/p&gt;
&lt;p&gt;ColorSpace: only "support" CS_sRGB&lt;/p&gt;
&lt;p&gt;-BH: This is a temporary edit just to get us started.&lt;/p&gt;
&lt;h2 id="javaxswingjfiledialog"&gt;javax.swing.JFileDialog&lt;/h2&gt;
&lt;p&gt;Not implemented. HTML5 cannot expose a file directory structure&lt;/p&gt;
&lt;h2 id="key-focus"&gt;key focus&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Less explicit key focus &lt;/li&gt;
&lt;li&gt;handling (mostly done by Browser/HTML)&lt;/li&gt;
&lt;li&gt;no SwingUtilities.findFocusOwner&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="static-methods-and-classes-order-is-important"&gt;static methods and classes -- order is important&lt;/h2&gt;
&lt;p&gt;J2S cannot run a static method that calls an uninitiated static variable:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    static int x = createX();

    static int createX() {
        return y;
    }

    static int y = 20;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will fail. It's actually quite odd that it does not fail in Java as well.&lt;/p&gt;
&lt;p&gt;Likewise, static classes hidden in other classes must be presented in an order&lt;br /&gt;
that does not call an uninitiated class. In java.util.Collections, for example,&lt;br /&gt;
it was important to move SynchronizedRandomAccessList to after SynchronizedList.&lt;/p&gt;
&lt;h2 id="inner-class-order"&gt;inner class order&lt;/h2&gt;
&lt;p&gt;For J2S, inner classes must not call other inner classes defined after them in a file.&lt;/p&gt;
&lt;p&gt;This showed up in java.awt.geom.Path2D.Float.CopyIterator, which extends&lt;br /&gt;
java.awt.geom.Path2D.Iterator. Since the Iterator is in the code after CopyIterator,&lt;br /&gt;
the reference to java.awt.geom.Path2D.Iterator in&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    &lt;span class="nx"&gt;c$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Clazz&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;decorateAsClass&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floatCoords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;Clazz&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instantialize&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"CopyIterator"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Path2D&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Iterator&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is null, and then CopyIterator does not extend Iterator.&lt;/p&gt;
&lt;p&gt;Solution is to simply move the inner class definitions in the .java file&lt;/p&gt;
&lt;h1 id="major-issues-for-bob-and-udo-within-swingjs"&gt;MAJOR ISSUES--for Bob and Udo within SwingJS&lt;/h1&gt;
&lt;h2 id="fonts"&gt;fonts&lt;/h2&gt;
&lt;p&gt;Fonts and FontMetrics will all be handled in JavaScript. Font matching will &lt;br /&gt;
not be exact, and composite (drawn) fonts will not be supported. &lt;/p&gt;
&lt;p&gt;Jmol handles calls such as font.getFontMetrics(g).stringWidth("xxx") by &lt;br /&gt;
creating an off-page DOM image and querying its context. &lt;br /&gt;
This will be done here as well.&lt;/p&gt;
&lt;h2 id="os-dependent-classes"&gt;OS-dependent classes&lt;/h2&gt;
&lt;p&gt;Static classes such as:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;   java.awt.Toolkit
   java.awt.GraphicsEnvironment
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which are created using Class.forName&lt;br /&gt;
will be implemented as JavaScript classes in the swingjs package&lt;/p&gt;
&lt;p&gt;AWTAccessor and  AwtContext are not implemented&lt;/p&gt;
&lt;h2 id="awt-component-peers"&gt;AWT component peers&lt;/h2&gt;
&lt;p&gt;ComponentPeer is a class that represents a native AWT component.&lt;br /&gt;
Components with such peers are called "heavy-weight" components.&lt;br /&gt;
They are expected to do the dirty work of graphics drawing. &lt;/p&gt;
&lt;p&gt;Java Swing implements peers only for JApplet, JDialog, JFrame, and JWindow. &lt;br /&gt;
References to such objects have been removed, but clearly there must be &lt;br /&gt;
some connection to similar DOM objects, even for "light-weight" components. &lt;/p&gt;
&lt;h1 id="major-issues-to-be-resolved-by-implementers"&gt;MAJOR ISSUES--to be resolved by implementers&lt;/h1&gt;
&lt;h2 id="fonts_1"&gt;fonts&lt;/h2&gt;
&lt;p&gt;Glyph/composite/outline fonts are not supported&lt;/p&gt;
&lt;h2 id="specific-awt-components-not-implemented"&gt;specific AWT components not implemented&lt;/h2&gt;
&lt;p&gt;The only AWT components implemented are Dialog, Frame, Panel, and Window&lt;br /&gt;
They are subclassed as JDialog, JFrame, JPanel/JApplet, and JWindow, respectively&lt;/p&gt;
&lt;h2 id="threads"&gt;threads&lt;/h2&gt;
&lt;p&gt;Thread locking and synchronization are not relevant to JavaScript.&lt;br /&gt;
Thus, anything requiring "notify.." or "waitFor.." could be a serious issue.&lt;/p&gt;
&lt;p&gt;All threading must be "faked" in JavaScript. Specifically not available is:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  Thread.sleep()
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;javax.swing.AbstractButton#doClick(pressTime) will not work, as it requires Thread.sleep();&lt;/p&gt;
&lt;p&gt;However, java.lang.Thread itself is implemented and used extensively. &lt;/p&gt;
&lt;p&gt;Methods thread.start() and thread.run() both work fine. &lt;/p&gt;
&lt;p&gt;In addition, SwingJS provides swingjs.JSThread, which can be subclassed&lt;br /&gt;
if desired. This class allows simple &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;  while(!interrupted()){
    wait()
    ...
  }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;action through an asynchronous function run1(mode). For example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    protected void run1(int mode) {
        try {
            while (true)
                switch (mode) {
                case INIT:
                    // once-through stuff here
                    mode = LOOP;
                    break;
                case LOOP:
                    if (!doDispatch || isInterrupted()) {
                        mode = DONE;
                    } else {
                        Runnable r = new Runnable() {
                            public void run() {
                                // put the loop code here
                            }
                        };
                        dispatchAndReturn(r);
                        if (isJS)
                            return;
                    }
                    break;
                // add more cases as needed
                case DONE:
                    // finish up here
                    if (isInterrupted())
                        return;
                    // or here
                    break;
                }
        } finally {
            // stuff here to be executed after each loop in JS or at the end in Java
        }
    }
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="image-loading"&gt;image loading&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;while JavaScript does not allow synchronous image loading, the JSmol framework gets around this by loading the binary image data synchronously and then using the data URI to deliver it synchronously to an Image element. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;BufferedImage: only "support" imageType RGB and ARGB&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-BH: This is a temporary edit, just to get us started. Certainly GRAY will be needed&lt;/p&gt;
&lt;h2 id="no-biginteger-no-bigdecimal"&gt;no BigInteger; no BigDecimal&lt;/h2&gt;
&lt;p&gt;BigInteger and BigDecimal are not supported&lt;/p&gt;
&lt;h2 id="no-format-internationalization"&gt;no format internationalization&lt;/h2&gt;
&lt;p&gt;For now, just en for number and date formatters&lt;/p&gt;
&lt;h2 id="text-related-field-implementation"&gt;text-related field implementation&lt;/h2&gt;
&lt;p&gt;Text fields are:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;JTextField   (JavaScript &amp;lt;input type="text"&amp;gt;)
JTextArea    (JavaScript &amp;lt;textarea&amp;gt;; TODO)
JTextPane    (JavaScript &amp;lt;div&amp;gt;; non-editing; TODO)
JEditorPane  NOT IMPLEMENTED
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For the initial implementation, we don't implement infinite undo/redo, and the abstract &lt;br /&gt;
document model is much less elaborate. Only PlainDocument (in the form of JSPlainDocument)&lt;br /&gt;
is implemented. &lt;/p&gt;
&lt;p&gt;Thus, the Document returned by JTextField.getDocument() is a javax.swing.text.Document, but it&lt;br /&gt;
is a swingjs.JSPlainDocument (extending swingjs.JSAbstractDocument)&lt;br /&gt;
rather than a javax.swing.text.PlainDocument (extending javax.swing.text.AbstractDocument).&lt;/p&gt;
&lt;p&gt;All scrolling is handled by HTML5.&lt;/p&gt;
&lt;p&gt;javax.swing.AutoScroller is not implemented&lt;/p&gt;
&lt;p&gt;public static methods .stop, .isRunning, .processMouseDragged require true Java threading&lt;br /&gt;
javax.swing.text.View and its subclasses are not implemented. &lt;/p&gt;
&lt;p&gt;The JS document model does not allow two fields to address the same underlying document. &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bob Hanson</dc:creator><pubDate>Thu, 11 Jun 2015 13:54:04 -0000</pubDate><guid>https://sourceforge.net08b8e216245273a728daa24e3960603a8fb60f96</guid></item></channel></rss>