Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190606154615
20190617071320
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190606154615
20190617071320
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
22 changes: 19 additions & 3 deletions sources/net.sf.j2s.java.core/doc/Differences.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ System.exit(0) does not stop all processes
list cell renderers must be JComponents
myClass.getField not implemented
"window" and other reserved JavaScript names

qualified field and method names
missing Math methods
component.getGraphics(), graphics.dispose()

MAJOR ISSUES--for Bob and Udo within SwingJS
============================================
Expand Down Expand Up @@ -488,14 +490,28 @@ qualified field and method names

In order to minimize the chance of added SwingJS field and method names colliding with
ones developers might use in subclassing Java classes, we have added U+79D8 (Mandarin "secrect")
to the characaters already disrecommended by Java documentation ("$" and "_"). The only problem
to the characters already disrecommended by Java documentation ("$" and "_"). The only problem
would be if you use that character followed by certain English words in certain classes. For example
\u79D8canvas for JComponents (in java.awt.JSComponent) and \u79D8byte (in java.io.File).

missing Math methods
--------------------

A few java.lang.Math
A few of the more obscure java.lang.Math methods are missing. This is a
result of continued Java development. It is easy enough to add these
methods if you have the source. They go into j2sClazz.js, which is
combined with other initial libraries into swingjs2.js.


component.getGraphics(), graphics.dispose()
-------------------------------------------

Use of component.getGraphics() is discouraged in Java and in SwingJS.
Specifically in SwingJS, any call to component.getGraphics() or
component.createGraphics() must be matched with graphics.dispose(),
particularly when it is called outside the context of a paint(Graphics)
call from the system.


MAJOR ISSUES--for Bob and Udo within SwingJS
============================================
Expand Down
8 changes: 3 additions & 5 deletions sources/net.sf.j2s.java.core/src/java/applet/JSApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import javax.swing.JRootPane;
import javax.swing.RepaintManager;

import swingjs.plaf.JSComponentUI;

/**
* SwingJS note: This class is the original java.applet.Applet class.
* It is subclassed by JApplet. The replacement java.applet.Applet class
Expand Down Expand Up @@ -265,7 +263,7 @@ public AppletContext getAppletContext() {
public void setVisible(boolean b) {
super.setVisible(b);
if (b)
repaint(); // BH SwingJS needs this, because there is no system event set to do this.
秘repaint(); // BH SwingJS needs this, because there is no system event set to do this.
}


Expand All @@ -289,8 +287,8 @@ public void resizeHTML(int width, int height) {
// Added 2/23/2019 to force layout prior to Canvas painting in mpFrakta.Applets.Geomet
JRootPane root = ((JApplet) this).getRootPane();
root.invalidate();
((JSComponentUI)root.getUI()).setPainted(null);
root.秘isBackgroundPainted = false;
// ((JSComponentUI)root.getUI()).setPainted(null);
// root.秘isBackgroundPainted = false;
RepaintManager.currentManager(this).addInvalidComponent(root);
}
}
Expand Down
18 changes: 10 additions & 8 deletions sources/net.sf.j2s.java.core/src/java/awt/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ protected void updatePeerVisibilityOrig(boolean isVisible) {
createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED, this, parent, HierarchyEvent.SHOWING_CHANGED,
Toolkit.enabledOnToolkit(AWTEvent.HIERARCHY_EVENT_MASK));
if (peer instanceof LightweightPeer) {
repaint();
((JSComponent)this).秘repaint();
}
updateCursorImmediately();
}
Expand Down Expand Up @@ -2112,7 +2112,7 @@ private void repaintParentIfNeeded(int oldX, int oldY, int oldWidth, int oldHeig
// Have the parent redraw the area this component occupied.
parent.repaint(oldX, oldY, oldWidth, oldHeight);
// Have the parent redraw the area this component *now* occupies.
repaint();
((JSComponent)this).秘repaint();
}
}

Expand Down Expand Up @@ -2697,7 +2697,9 @@ protected final void invalidateIfValid() {

/**
*
* For SwingJS, we have the graphics without needing to get it from a peer.
* Unused in SwingJS. For SwingJS, we have the graphics without needing to get it from a peer.
* @see JSComponent.getGraphics
*
* Creates a graphics context for this component. This method will return
* <code>null</code> if this component is currently not displayable.
*
Expand Down Expand Up @@ -3832,6 +3834,9 @@ protected void dispatchEventImplComp(AWTEvent e) {
// selectively for non-native components on Windows only.
// - Fred.Ecks@Eng.sun.com, 5-8-98

case PaintEvent.UPDATE:
((JSComponent)this).秘update();
break;
case KeyEvent.KEY_PRESSED:
case KeyEvent.KEY_RELEASED:
Container p = (Container) ((this instanceof Container) ? this : parent);
Expand Down Expand Up @@ -5402,7 +5407,7 @@ protected void processFocusEvent(FocusEvent e) {
*/
protected void processKeyEvent(KeyEvent e) {
KeyListener listener = keyListener;
if (listener != null && (/** @j2sNative this.isAWT$ || */ 秘isFocusableSet)) {
if (listener != null && (((JSComponent)this).秘isAWT()|| 秘isFocusableSet)) {
int id = e.getID();
switch (id) {
case KeyEvent.KEY_TYPED:
Expand Down Expand Up @@ -5785,10 +5790,6 @@ public boolean action(Event evt, Object what) {
* @since JDK1.0
*/
public void addNotify() {
addNotifyComp();
}

protected void addNotifyComp() {
synchronized (getTreeLock()) {
ComponentPeer peer = getOrCreatePeer();
// this.peer;
Expand Down Expand Up @@ -8308,4 +8309,5 @@ static boolean doesImplement(Object obj, String interfaceName) {
return doesClassImplement(obj.getClass(), interfaceName);
}


}
25 changes: 12 additions & 13 deletions sources/net.sf.j2s.java.core/src/java/awt/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ public Insets getInsets() {
return (i == null ? NULL_INSETS : i);
}

public Insets 秘getInsetsC() {
// in SwingJS, we do not clone. Everything is a ContainerPeer.
// it is inconsistent with other classes that this would need cloning.
Insets i = (peer == null ? null : ((ContainerPeer) peer).getInsets());
return (i == null ? NULL_INSETS : i);
}

@Deprecated
public Insets insets() {
return getInsets();
Expand Down Expand Up @@ -1277,7 +1284,7 @@ public void remove(Component comp) {
* @see #add
* @see #remove
*/
public void removeAll() {
public void removeAll() {
synchronized (getTreeLock()) {
adjustListeningChildren(AWTEvent.HIERARCHY_EVENT_MASK,
-listeningChildren);
Expand Down Expand Up @@ -1309,20 +1316,12 @@ public void removeAll() {
HierarchyEvent.PARENT_CHANGED,
Toolkit.enabledOnToolkit(AWTEvent.HIERARCHY_EVENT_MASK));
}
if (peer != null) {
if (layoutMgr == null && isVisible()) {
updateCursorImmediately();
}
if (isVisible()) {
// this did not work -- see _mpEnigma_Applets_textana_Textanalyzer2_node4.htm
Graphics g = getGraphics();
if (g != null)
g.clearRect(0, 0, width, height);

}
if (peer != null && layoutMgr == null && isVisible()) {
updateCursorImmediately();
}
invalidateIfValid();
}
super.removeAll();
}

// Should only be called while holding tree lock
Expand Down Expand Up @@ -2732,7 +2731,7 @@ public void addNotify() {
// on this instance, so we first call addNotifyComp() and
// possibly create an lightweight event dispatcher before calling
// addNotify() on the children which may be lightweight.
addNotifyComp();
super.addNotify();
if (! (peer instanceof LightweightPeer)) {
setDispatcher();
}
Expand Down
8 changes: 4 additions & 4 deletions sources/net.sf.j2s.java.core/src/java/awt/EventQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ private void postEventNow(AWTEvent theEvent, int priority) {
}

private boolean coalescePaintEvent(PaintEvent e) {
ComponentPeer sourcePeer = ((Component) e.getSource()).peer;
if (sourcePeer != null) {
sourcePeer.coalescePaintEvent(e);
}
//SwingJS ComponentPeer sourcePeer = ((Component) e.getSource()).peer;
// if (sourcePeer != null) {
// sourcePeer.coalescePaintEvent(e);
// }
EventQueueItem[] cache = ((Component) e.getSource()).eventCache;
if (cache == null) {
return false;
Expand Down
Loading