Skip to content

Commit 7133732

Browse files
hansonrhansonr
authored andcommitted
Fixes issue that JTextField and JTextArea not responding to text input
in JFrame
1 parent c6c85db commit 7133732

File tree

17 files changed

+193
-856
lines changed

17 files changed

+193
-856
lines changed
116 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190816123836
1+
20190817161814
116 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190816123836
1+
20190817161814
116 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/JSGraphicsConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ protected BufferedImage newBufferedImage(ColorModel cm, WritableRaster wr,
5656
boolean alphaPremultiplied, Hashtable<?, ?> properties) {
5757
return (BufferedImage) Interface.getInstanceWithParams(
5858
"java.awt.image.BufferedImage", new Class<?>[] { ColorModel.class,
59-
WritableRaster.class, Boolean.class, Hashtable.class },
59+
WritableRaster.class, boolean.class, Hashtable.class },
6060
new Object[] { cm, wr,
61-
alphaPremultiplied ? Boolean.TRUE : Boolean.FALSE, properties });
61+
alphaPremultiplied, properties });
6262
}
6363

6464
@Override

sources/net.sf.j2s.java.core/src/swingjs/JSMouse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ private static boolean isPopupTrigger(int id, int mods, boolean isWin) {
495495

496496
private boolean keyAction(int id, Object jqevent, long time) {
497497
JComponent c = /** @j2sNative
498-
jqevent.target["data-shadowkeycomponent"] || jqevent.target["data-keycomponent"]
499-
*/null;
498+
jqevent.target["data-shadowkeycomponent"] || jqevent.target["data-keycomponent"] ||
499+
*/null;
500500
return JSKeyEvent.dispatchKeyEvent(c, id, jqevent, time);
501501
}
502502

sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,12 +964,13 @@ public static void consumeEvent(Object e) {
964964
// SwingJS stop any further processing at all within the browser
965965
Object jqevent = null;
966966
if (e instanceof InputEvent) {
967-
jqevent = /** @j2sNative e.bdata.jqevent || */null;
967+
jqevent = /** @j2sNative e.bdata && e.bdata.jqevent || */null;
968968
} else {
969969
jqevent = e;
970970
}
971971
if (jqevent == null)
972972
return;
973+
973974
/**
974975
* @j2sNative
975976
* jqevent.stopPropagation();

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,18 @@ protected void bindJSKeyEvents(DOMNode node, boolean addFocus) {
11031103
}
11041104
}
11051105

1106+
1107+
1108+
/**
1109+
* Signal to swingjs2 to ignore the event, as it has been handled already.
1110+
*
1111+
* @param jqevent
1112+
*/
1113+
void setIgnoreEvent(Object jqevent) {
1114+
/**
1115+
* @j2sNative jqevent.originalEvent.xhandled = true;
1116+
*/
1117+
}
11061118
/**
11071119
* Allows mouse and keyboard handling via an overridden method
11081120
*

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSEditorPaneUI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
949949
* jQueryEvent.preventDefault();
950950
* jQueryEvent.stopPropagation();
951951
*/
952+
setIgnoreEvent(jQueryEvent);
952953
return HANDLED;
953954
}
954955
}

0 commit comments

Comments
 (0)