Skip to content

Commit ccd80a4

Browse files
hansonrhansonr
authored andcommitted
additional textpane/textarea work.
1 parent 8ebaaaa commit ccd80a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3492
-1658
lines changed
256 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190102082521
1+
20190104050701
256 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190102082521
1+
20190104050701

sources/net.sf.j2s.core/doc/Differences.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Notes
22
=====
33

4+
update 12/4/2019 -- 3.2.4.07
5+
6+
this update advances JTextArea, JTextPane, and JEditorPane, and adds many more classes of java.nio.
7+
48
update 10/1/2018 -- 3.2.4.01
59

610
AWT components in SwingJS:
0 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/doc/Differences.txt

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Notes
22
=====
3-
updated 9/15/19 -- adds integer 1/0 == 0
3+
updated 1/4/19 -- nio
4+
updated 9/15/18 -- adds integer 1/0 == 0
45
updated 7/24/18 -- most classes replaced with https://github.com/frohoff/jdk8u-jdk
56
updated 6/28/18 -- arrays do not inherit Object
67
updated 2/26/18
@@ -21,7 +22,7 @@ implemented using older source code, and there are some missing methods.
2122
DESIGN PHILOSOPHY
2223
=================
2324

24-
The SwingJS design goal is to recreate a recognizable, easily debuggable
25+
The java2script/SwingJS design goal is to recreate a recognizable, easily debuggable
2526
equivalent in JavaScript for as much of Java as practical. This means, for example,
2627
that one can call in JavaScript
2728

@@ -49,8 +50,8 @@ Obviously, there are limitations. One is performance, but we have seen reproduci
4950
performance at 1/6 - 1/3 the speed of Java. Achieving this performance may require
5051
some refactoring of the Java to make it more efficient in both Java and JavaScript.
5152
"for" loops need to be more carefully crafted; use of "new" and "instanceof" need to be
52-
minimized in critical areas; overloaded methods (methods with the same name but different
53-
signatures) should be renamed.
53+
minimized in critical areas. Note that method overloading -- that is, the same method name
54+
with different parameters, such as read(int) and read(byte) -- is no longer any problem.
5455

5556

5657
Threads
@@ -74,35 +75,6 @@ return PropertyChangeEvents to signal that they have been disposed of and contai
7475
More on this later....
7576

7677

77-
78-
No Non-Swing AWT Components
79-
---------------------------
80-
81-
Swing was introduced into Java well after the Java Abstract Window Toolkit (AWT) was well
82-
established. As such, its designers chose to allow AWT controls such as Button and List to be used
83-
alongside their Swing counterparts JButton and JList. Reading the code, it is clear that this
84-
design choice posed a huge headache for Swing class developers.
85-
86-
For SwingJS, we decided from the beginning NOT to allow this mixed-mode programming and
87-
instead to require that all components be Swing components. However...
88-
89-
The a2s Adapter Package
90-
-----------------------
91-
92-
...originally, we thought that we would restrict ourselves to JApplets only. That is, only
93-
Swing-based applets. But as we worked, we discovered that there are a lot of great
94-
applets out there that are pre-Swing pure-AWT java.applet.Applet applets. Our problem was
95-
that we also wanted it to be possible to quickly adapt these applets to JavaScript as well.
96-
97-
The solution turned out to be simple: Write a package (a2s) that recreates the interface for
98-
non-Swing components as subclasses of Swing components. Thus, a2s.Button subclasses javax.swing.JButton
99-
but also accepts all of the methods of java.awt.Button. It's not perfect, and the ultimate
100-
solution is probably to just change java.awt.Xxxx itself to subclass javax.swing.JXxxx.
101-
In any case, it works -- mostly. By adding the a2s package to a project and changing the include
102-
statements to target a2s instead of java.awt, non-Swing applets can be easily converted to JavaScript.
103-
Certainly there will be issues such as missing methods. It is all a work in progress.
104-
105-
10678
Native calls
10779
------------
10880

@@ -119,7 +91,9 @@ Swing GUI Peers and UIClasses
11991

12092
One of the biggest adaptations introduced in SwingJS is in the area of the graphical
12193
user interface. The issue here is complex but workable. In Java there are two background
122-
concepts -- the Component "peer" (one per component) and the Component "uiClass" (one per class).
94+
concepts -- the Component "peer" (one per "heavy-weight" component, such as a Frame) and the
95+
component "uiClass" (one per component, such as JButton or JTextField).
96+
12397
Peers are native objects of the operating system. These are the virtual buttons and text areas
12498
that the user is interacting with at a very base level. Their events are being passed on to
12599
Java or the browser by the operating system. UI classes provide a consistent "look and feel"
@@ -139,7 +113,7 @@ more adaptable, this approach allows far more versatility to SwingJS developers,
139113
to modify the GUI to suit their needs if desired.
140114

141115
In SwingJS, since we have no access to native peers except through the browser DOM,
142-
it seemed logical to merge the peer and UI idea. So instead of having one peer per control and
116+
it seemed logical to merge the peer and UI idea. So instead of having one peer per heavy-weight control and
143117
one UI class instance for each control type, we just have one UI class instance per control, and
144118
that UI class instance is what is being referred to when a "peer" is notified.
145119

@@ -154,6 +128,40 @@ The origin of most issues (read "bugs") in relation to the GUI will probably be
154128
swingjs.plaf JSxxxxUI.java code.
155129

156130

131+
Swing-only Components -- no longer an issue
132+
-------------------------------------------
133+
134+
Swing was introduced into Java well after the Java Abstract Window Toolkit (AWT) was well
135+
established. As such, its designers chose to allow AWT controls such as Button and List to be used
136+
alongside their Swing counterparts JButton and JList. Reading the code, it is clear that this
137+
design choice posed a huge headache for Swing class developers.
138+
139+
For SwingJS, we decided from the beginning NOT to allow this mixed-mode programming and
140+
instead to require that all components be Swing components.
141+
142+
However, this is no longer an issue. All AWT components in SwingJS are now subclasses of
143+
javax.swing.JComponent. So far, we have found no problem with this.
144+
145+
146+
The a2s Adapter Package
147+
-----------------------
148+
149+
Originally, we thought that we would restrict ourselves to JApplets only. That is, only
150+
Swing-based applets. But as we worked, we discovered that there are a lot of great
151+
applets out there that are pre-Swing pure-AWT java.applet.Applet applets. Our problem was
152+
that we also wanted it to be possible to quickly adapt these applets to JavaScript as well.
153+
154+
The solution turned out to be simple: Write a package (a2s) that recreates the interface for
155+
non-Swing components as subclasses of Swing components. Thus, a2s.Button subclasses javax.swing.JButton
156+
but also accepts all of the methods of java.awt.Button. It's not perfect, and the ultimate
157+
solution is probably to just change java.awt.Xxxx itself to subclass javax.swing.JXxxx.
158+
In any case, it works -- mostly. By adding the a2s package to a project and changing the include
159+
statements to target a2s instead of java.awt, non-Swing applets can be easily converted to JavaScript.
160+
Certainly there will be issues such as missing methods. It is all a work in progress.
161+
162+
All AWT components now subclass a2s components, which in turn subclass JComponet.
163+
164+
157165

158166
UNIMPLEMENTED CLASSES BY DESIGN
159167
===============================
@@ -167,9 +175,11 @@ keyboard accelerators
167175
TODO LIST FOR UNIMPLEMENTED CLASSES
168176
===================================
169177

170-
JEditorPane (minimal implementation)
171-
JSplitPane (in development, BH)
172-
JTabbedPane (in development, NEM)
178+
JEditorPane (minimal implementation) - DONE 12/2018
179+
JSplitPane - DONE 8/2018
180+
JTabbedPane - DONE 10/2018
181+
182+
JTree
173183

174184

175185
MINOR ISSUES--required some rewriting/refactoring by Bob and Udo
@@ -234,6 +244,12 @@ as it is used to key for AppContexts. We will see if that use useful or not.
234244
PROGRESS
235245
========
236246

247+
1/4/2019
248+
249+
Over the course of 7/2018 - 12/2018 there have been many updates to Java2Script/SwingJS.
250+
251+
252+
237253
6/28/2018
238254

239255
Major bug fixing session in Dundee, Scotland, is finding subtle issues and some missing

0 commit comments

Comments
 (0)