Skip to content

Commit 290ed2d

Browse files
committed
Review comment
1 parent fc830a7 commit 290ed2d

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public class JFXPanel extends JComponent {
153153
// Set in FX thread and accessed in EDT/FX threads
154154
private transient volatile EmbeddedWindow stage;
155155

156+
// Set and accessed in FX thread only
156157
private transient volatile Scene scene;
157158

158159
// Accessed on EDT only
@@ -963,15 +964,14 @@ private void setFxEnabled(boolean enabled) {
963964
}
964965

965966
private transient AWTEventListener ungrabListener = event -> {
966-
var hStagePeer = JFXPanel.this.stagePeer;
967967

968968
if (jfxPanelIOP.isUngrabEvent(event)) {
969969
SwingNodeHelper.runOnFxThread(() -> {
970-
if (hStagePeer != null &&
970+
if (JFXPanel.this.stagePeer != null &&
971971
getScene() != null &&
972972
getScene().getFocusOwner() != null &&
973973
getScene().getFocusOwner().isFocused()) {
974-
hStagePeer.focusUngrab();
974+
JFXPanel.this.stagePeer.focusUngrab();
975975
}
976976
});
977977
}
@@ -985,15 +985,15 @@ private void setFxEnabled(boolean enabled) {
985985

986986
if (jfxPanelWindow == eventWindow) {
987987
SwingNodeHelper.runOnFxThread(() -> {
988-
if (hStagePeer != null) {
988+
if (JFXPanel.this.stagePeer != null) {
989989
// No need to check if grab is active or not.
990990
// NoAutoHide popups don't request the grab and
991991
// ignore the Ungrab event anyway.
992992
// AutoHide popups actually should be hidden when
993993
// user clicks some non-FX content, even if for
994994
// some reason they didn't install the grab when
995995
// they were shown.
996-
hStagePeer.focusUngrab();
996+
JFXPanel.this.stagePeer.focusUngrab();
997997
}
998998
});
999999
}
@@ -1019,8 +1019,8 @@ public void addNotify() {
10191019
if ((stage != null) && !stage.isShowing()) {
10201020
stage.show();
10211021
}
1022+
SwingNodeHelper.runOnEDT(() -> sendMoveEventToFX());
10221023
});
1023-
sendMoveEventToFX();
10241024
}
10251025

10261026
@Override

tests/system/src/test/java/test/javafx/embed/swing/JFXPanelNPETest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public void uncaughtException(Thread t, Throwable e) {
102102
Platform.runLater(() -> contentPane.setScene(webView.getScene()));
103103
Thread.sleep(100);
104104
}
105-
System.out.println("failure = " + failure.get());
106105
Assertions.assertFalse(failure.get());
107106
}
108107

0 commit comments

Comments
 (0)