javafx-embed-swing/src/javafx/embed/swing/JFXPanel.java

Print this page

        

@@ -658,11 +658,11 @@
 
     private final AWTEventListener ungrabListener = new AWTEventListener() {
         @Override
         public void eventDispatched(AWTEvent event) {
             if (event instanceof sun.awt.UngrabEvent) {
-                Platform.runLater(new Runnable() {
+                SwingFXUtils.runOnFxThread(new Runnable() {
                     @Override
                     public void run() {
                         if (JFXPanel.this.stagePeer != null) {
                             JFXPanel.this.stagePeer.focusUngrab();
                         }

@@ -691,11 +691,11 @@
             }
         });
 
         updateComponentSize(); // see RT-23603
 
-        Platform.runLater(new Runnable() {
+        SwingFXUtils.runOnFxThread(new Runnable() {
             @Override
             public void run() {
                 if ((stage != null) && !stage.isShowing()) {
                     stage.show();
                     firstPanelShown = true;

@@ -709,11 +709,11 @@
      * Notifies this component that it no longer has a parent component.
      * When this method is invoked, any KeyboardActions set up in the the
      * chain of parent components are removed.
      */
     @Override public void removeNotify() {
-        Platform.runLater(new Runnable() {
+        SwingFXUtils.runOnFxThread(new Runnable() {
             @Override
             public void run() {
                 if ((stage != null) && stage.isShowing()) {
                     stage.hide();
                 }