11Notes
22=====
3+ updated 8/16/19 -- minor typos and added summary paragraph
34updated 7/19/19 -- clarification that AWT and Swing classes are supported directly
45updated 5/13/19 -- Mandarin U+79D8 reserved character; Missing Math methods; int and long
56updated 5/10/19 -- adds a section on static issues in multi-(duplicate)-applet pages
67updated 1/4/19 -- nio
7- updated 9/15/18 -- adds integer 1/0 == 0
8+ updated 9/15/18 -- adds integer 1/0 == Infinity
89updated 7/24/18 -- most classes replaced with https://github.com/frohoff/jdk8u-jdk
910updated 6/5/17 -- reserved package name "window"
1011updated 3/11/17 -- myClass.getField
@@ -537,14 +538,14 @@ qualified field and method names
537538
538539In order to minimize the chance of added SwingJS field and method names colliding with ones
539540developers might use in subclassing Java classes, we have added U+79D8 (first character of Mandarin
540- "secrect ") to the characters already disrecommended by Java documentation ("$" and "_"). The only problem
541+ "secret ") to the characters already disrecommended by Java documentation ("$" and "_"). The only problem
541542would be if you use that character followed by certain English words in certain classes. For example
542543\u79D8canvas for JComponents (in java.awt.JSComponent) and \u79D8byte (in java.io.File).
543544
544545missing Math methods
545546--------------------
546547
547- java.lang.Math is worked out, but some methods are missing, eithr because they
548+ java.lang.Math is worked out, but some methods are missing, either because they
548549involve long integer value that are inaccessible in JavaScript, or because I just
549550didn't implement them. This is a result of continued Java development.
550551It is easy enough to add these methods if you have the source. They go into j2sClazz.js,
@@ -566,7 +567,7 @@ For example, this will definitely NOT work in SwingJS:
566567
567568 this.paint(getGraphics())
568569
569- and really should not in Java, either, as it is technically a resource memory leak.
570+ and really should not work in Java, either, as it is technically a resource memory leak.
570571
571572Instead, if you really do not want to use repaint(), use this:
572573
@@ -601,7 +602,7 @@ Static classes such as:
601602
602603which are created using Class.forName are implemented using classes in the swingjs package.
603604
604- AWTAccessor and AwtContext need to be customized
605+ AWTAccessor is not implemented.
605606
606607
607608AWT component peers and component "ui" user interfaces
@@ -739,7 +740,7 @@ to BigInteger:
739740 * the integer storage bit length to 24, giving 48 for long and leaving
740741 * the last 16 bits clear for the exponent of the double number. This should
741742 * not affect performance significantly. It does increase the storage
742- * size by about 33%. By bring an "int" to 3 bytes, we can easily construct
743+ * size by about 33%. By bringing an "int" to 3 bytes, we can easily construct
743744 * and use byte[] data intended for the original BitSet.
744745
745746"Easily" may be a bit strong there. This was a serious challenge.
@@ -772,13 +773,11 @@ JEditorPane (JavaScript <div>)
772773
773774For the initial implementation, we don't implement infinite undo/redo, and the abstract
774775document model is much less elaborate. Only PlainDocument (in the form of JSPlainDocument)
775- is implemented.
776- The Document returned by JTextField.getDocument() is a javax.swing.text.Document.
776+ is implemented. The Document returned by JTextField.getDocument() is a javax.swing.text.Document.
777777
778- all scrolling is handled by HTML5
779- javax.swing.AutoScroller is not implemented
778+ All scrolling is handled by HTML5. javax.swing.AutoScroller is not implemented.
780779public static methods .stop, .isRunning, .processMouseDragged require true Java threading
781- javax.swing.text.View and its subclasses are not implemented.
780+ and so are not implmented. javax.swing.text.View and its subclasses are not implemented.
782781
783782The JS document model does not allow two text fields to address the same underlying document.
784783
@@ -792,9 +791,23 @@ Matcher.start(groupID) is not supported.
792791
793792java.util.Formatter will function correctly for all standard %... patterns.
794793
795- integer 1/0 == 0
796- ----------------
794+ integer 1/0 == Infinity
795+ -----------------------
797796
7987971/0 in Java throws "java.lang.ArithmeticException: / by zero", but in JavaScript is just Infinity.
799798
800-
799+
800+
801+ Summary
802+ -------
803+
804+ These are all the known limitations of SwingJS. We have not found any of these limitations
805+ to be show-stoppers. The primary issue for newcomers to SwingJS is having the source code.
806+ You must check that source code for all your library jar files is available or, if you
807+ choose, you will need to decompile those classes. We have used decompilation on some projects,
808+ and it works just fine. So, technically, all we really need are JAR/class files. But the
809+ source is by far superior. It's generally prettier, and it has the license information that
810+ may or may not be present with the JAR or class files. Use class files at your own risk.
811+
812+ Bob Hanson
813+ 2019.08.16
0 commit comments