Skip to content

Commit 91ab2db

Browse files
hansonrhansonr
authored andcommitted
fix for KT#92 - mouse-up out of applet does not always fire event
listener
1 parent 36ee93e commit 91ab2db

File tree

3 files changed

+302
-300
lines changed

3 files changed

+302
-300
lines changed

sources/net.sf.j2s.java.core/src/java/awt/Container.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4359,6 +4359,8 @@ private boolean processMouseEvent(MouseEvent e) {
43594359
}
43604360
// SwingJS note: This was moved here 7/8/2019 from above.
43614361
targetLastKnown = (actualTarget == null ? mouseOver : actualTarget);
4362+
if (id == MouseEvent.MOUSE_PRESSED)
4363+
targetLastDown = targetLastKnown;
43624364

43634365
// 4508327 : MOUSE_CLICKED should only go to the recipient of
43644366
// the accompanying MOUSE_PRESSED, so don't reset mouseEventTarget on a
@@ -4379,7 +4381,6 @@ else if (!isMouseGrab(e) && id != MouseEvent.MOUSE_CLICKED) {
43794381
break;
43804382
case MouseEvent.MOUSE_PRESSED:
43814383
checkInternalFrameMouseDown((JSComponent) e.getSource());
4382-
targetLastDown = mouseEventTarget;
43834384
retargetMouseEvent(mouseEventTarget, id, e);
43844385
break;
43854386
case MouseEvent.MOUSE_RELEASED:

sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
1+
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
22

33
// J2S._version set to "3.2.4.07" 2019.01.04; 2019.02.06
44

@@ -975,7 +975,7 @@ console.log("J2S._getRawDataFromServer " + J2S._serverUrl + " for " + query);
975975
case "java.io.File":
976976
var f = Clazz.new_(Clazz.load("java.io.File").c$$S,
977977
[ file.name ]);
978-
f.秘bytes = J2S._toBytes(data);
978+
f.?bytes = J2S._toBytes(data);
979979
return fDone(f);
980980
case "ArrayBuffer":
981981
break;
@@ -2908,6 +2908,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
29082908
}, 502);
29092909
return false;
29102910
} else {
2911+
setTimeout(function(){document.body.dispatchEvent(ev.ev0.originalEvent)},50)
29112912
}
29122913
};
29132914

0 commit comments

Comments
 (0)