changeset 11131:1f990b4b789a 12+6

8211249: Refactor javafx.swing implementation to get rid of unneeded abstraction layer Reviewed-by: kcr
author psadhukhan
date Mon, 17 Dec 2018 11:35:12 +0530
parents f593c24b8680
children a7fa648f94e4
files modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/FXDnD.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/FXDnDInterop.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/InteropFactory.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/JFXPanelInterop.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingFXUtilsImpl.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingFXUtilsImplInterop.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingNodeInterop.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/FXDnDInteropN.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/InteropFactoryN.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/JFXPanelInteropN.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/SwingFXUtilsImplInteropN.java modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/SwingNodeInteropN.java modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java modules/javafx.swing/src/main/java/javafx/embed/swing/SwingNode.java
diffstat 14 files changed, 18 insertions(+), 356 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/FXDnD.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/FXDnD.java	Mon Dec 17 11:35:12 2018 +0530
@@ -35,6 +35,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import javafx.embed.swing.SwingNode;
+import com.sun.javafx.embed.swing.newimpl.FXDnDInteropN;
 
 /**
  * A utility class to connect DnD mechanism of Swing and FX.
@@ -44,7 +45,7 @@
     private static SwingNode node;
     public static boolean fxAppThreadIsDispatchThread;
     private SwingNode getNode() { return node; }
-    private static FXDnDInterop fxdndiop;
+    private FXDnDInteropN fxdndiop;
 
     static {
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
@@ -55,18 +56,12 @@
             }
         });
 
-    InteropFactory instance = null;
-    try {
-        instance = InteropFactory.getInstance();
-    } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-    }
-        fxdndiop = instance.createFXDnDImpl();
     }
 
     public FXDnD(SwingNode node) {
         this.node = node;
-    fxdndiop.setNode(node);
+        fxdndiop = new FXDnDInteropN();
+        fxdndiop.setNode(node);
     }
 
     public Object createDragSourceContext(DragGestureEvent dge)
@@ -83,7 +78,7 @@
     }
 
     public void addDropTarget(DropTarget dt) {
-    fxdndiop.addDropTarget(dt, node);
+        fxdndiop.addDropTarget(dt, node);
     }
 
     public void removeDropTarget(DropTarget dt) {
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/FXDnDInterop.java	Fri Dec 14 17:01:37 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.embed.swing;
-
-import java.awt.Component;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragGestureRecognizer;
-import java.awt.dnd.DragSource;
-import java.awt.dnd.DropTarget;
-import javafx.embed.swing.SwingNode;
-
-public abstract class FXDnDInterop {
-    public abstract Component findComponentAt(Object frame, int x, int y,
-                                      boolean ignoreEnabled);
-
-    public abstract boolean isCompEqual(Component c, Object frame);
-
-    public abstract int convertModifiersToDropAction(int modifiers,
-                                             int supportedActions);
-
-    public abstract Object createDragSourceContext(DragGestureEvent dge);
-
-    public abstract <T extends DragGestureRecognizer> T
-        createDragGestureRecognizer(DragSource ds, Component c, int srcActions,
-                DragGestureListener dgl);
-
-    public abstract void addDropTarget(DropTarget dt, SwingNode node);
-
-    public abstract void removeDropTarget(DropTarget dt, SwingNode node);
-
-    public abstract void setNode(SwingNode node);
-}
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/InteropFactory.java	Fri Dec 14 17:01:37 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.embed.swing;
-
-import com.sun.javafx.embed.swing.newimpl.InteropFactoryN;
-
-public abstract class InteropFactory {
-    private static InteropFactory instance = null;
-
-    public synchronized static InteropFactory getInstance() throws Exception {
-        if (instance == null) {
-            instance = new InteropFactoryN();
-        }
-        return instance;
-    }
-
-    public abstract SwingNodeInterop createSwingNodeImpl();
-    public abstract JFXPanelInterop createJFXPanelImpl();
-    public abstract FXDnDInterop createFXDnDImpl();
-    public abstract SwingFXUtilsImplInterop createSwingFXUtilsImpl();
-}
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/JFXPanelInterop.java	Fri Dec 14 17:01:37 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.embed.swing;
-
-import java.awt.AWTEvent;
-import java.awt.Toolkit;
-import java.awt.Window;
-import javafx.embed.swing.JFXPanel;
-
-public abstract class JFXPanelInterop {
-    public abstract void postEvent(JFXPanel panel, AWTEvent e);
-
-    public abstract boolean isUngrabEvent(AWTEvent event);
-
-    public abstract long getMask();
-
-    public abstract void grab(Toolkit toolkit, Window w);
-
-    public abstract void ungrab(Toolkit toolkit, Window w);
-}
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingFXUtilsImpl.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingFXUtilsImpl.java	Mon Dec 17 11:35:12 2018 +0530
@@ -28,19 +28,14 @@
 import java.awt.EventQueue;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import com.sun.javafx.embed.swing.newimpl.SwingFXUtilsImplInteropN;
 
 public class SwingFXUtilsImpl {
 
-    private static SwingFXUtilsImplInterop swFXUtilIOP;
+    private static SwingFXUtilsImplInteropN swFXUtilIOP;
 
     static {
-        InteropFactory iopFactoryInstance = null;
-        try {
-            iopFactoryInstance = InteropFactory.getInstance();
-        } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-        }
-        swFXUtilIOP = iopFactoryInstance.createSwingFXUtilsImpl();
+        swFXUtilIOP = new SwingFXUtilsImplInteropN();
     }
 
     private static EventQueue getEventQueue() {
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingFXUtilsImplInterop.java	Fri Dec 14 17:01:37 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.embed.swing;
-
-import java.awt.EventQueue;
-
-public abstract class SwingFXUtilsImplInterop {
-    public abstract void setFwDispatcher(EventQueue eventQueue);
-}
-
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingNodeInterop.java	Fri Dec 14 17:01:37 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.embed.swing;
-
-import com.sun.javafx.embed.swing.DisposerRecord;
-import java.awt.AWTEvent;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.WindowFocusListener;
-import javafx.embed.swing.SwingNode;
-import javax.swing.JComponent;
-
-public abstract class SwingNodeInterop {
-
-    public abstract Object createLightweightFrame();
-    public abstract Object getLightweightFrame();
-    public abstract void disposeFrame(Object frame);
-
-    public abstract java.awt.event.MouseEvent createMouseEvent(Object lwFrame,
-                            int swingID, long swingWhen, int swingModifiers,
-                            int relX, int relY, int absX, int absY,
-                            int clickCount, boolean swingPopupTrigger,
-                            int swingButton);
-
-    public abstract MouseWheelEvent createMouseWheelEvent(Object lwFrame,
-                            int swingModifiers, int x, int y, int wheelRotation);
-
-    public abstract java.awt.event.KeyEvent createKeyEvent(Object lwFrame,
-                                   int swingID, long swingWhen,
-                                   int swingModifiers,
-                                   int swingKeyCode, char swingChar);
-
-    public abstract AWTEvent createUngrabEvent(Object lwFrame);
-
-    public abstract void overrideNativeWindowHandle(Object frame, long handle, Runnable closeWindow);
-    public abstract void addWindowFocusListener(Object frame, WindowFocusListener l);
-    public abstract void notifyDisplayChanged(Object frame, double scaleX, double scaleY);
-    public abstract void setHostBounds(Object frame, int windowX, int windowY,
-                               int windowW, int windowH);
-    public abstract void setContent(Object frame, Object content);
-    public abstract void setVisible(Object frame, boolean visible);
-    public abstract void setBounds(Object frame, int frameX, int frameY, int frameW, int frameH);
-    public abstract void emulateActivation(Object frame, boolean activate);
-
-    public abstract Object createSwingNodeContent(JComponent content, SwingNode node);
-
-    public abstract DisposerRecord createSwingNodeDisposer(Object lwFrame);
-
-}
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/FXDnDInteropN.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/FXDnDInteropN.java	Mon Dec 17 11:35:12 2018 +0530
@@ -27,7 +27,6 @@
 
 import com.sun.javafx.embed.swing.CachingTransferable;
 import com.sun.javafx.embed.swing.FXDnD;
-import com.sun.javafx.embed.swing.FXDnDInterop;
 import com.sun.javafx.embed.swing.SwingDnD;
 import com.sun.javafx.embed.swing.SwingEvents;
 import com.sun.javafx.embed.swing.SwingNodeHelper;
@@ -65,7 +64,7 @@
 import jdk.swing.interop.DropTargetContextWrapper;
 import jdk.swing.interop.LightweightFrameWrapper;
 
-public class FXDnDInteropN extends FXDnDInterop {
+public class FXDnDInteropN {
 
     public Component findComponentAt(Object frame, int x, int y,
                                               boolean ignoreEnabled) {
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/InteropFactoryN.java	Fri Dec 14 17:01:37 2018 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.embed.swing.newimpl;
-
-import com.sun.javafx.embed.swing.FXDnDInterop;
-import com.sun.javafx.embed.swing.InteropFactory;
-import com.sun.javafx.embed.swing.JFXPanelInterop;
-import com.sun.javafx.embed.swing.SwingFXUtilsImplInterop;
-import com.sun.javafx.embed.swing.SwingNodeInterop;
-
-public class InteropFactoryN extends InteropFactory {
-
-    public InteropFactoryN() throws Exception {
-        Class swiopClass = Class.forName("jdk.swing.interop.LightweightFrameWrapper");
-    }
-
-    @Override
-    public SwingNodeInterop createSwingNodeImpl() {
-        return new SwingNodeInteropN();
-    }
-
-    @Override
-    public JFXPanelInterop createJFXPanelImpl() {
-        return new JFXPanelInteropN();
-    }
-
-    @Override
-    public FXDnDInterop createFXDnDImpl() {
-        return new FXDnDInteropN();
-    }
-
-    @Override
-    public SwingFXUtilsImplInterop createSwingFXUtilsImpl() {
-        return new SwingFXUtilsImplInteropN();
-    }
-}
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/JFXPanelInteropN.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/JFXPanelInteropN.java	Mon Dec 17 11:35:12 2018 +0530
@@ -25,14 +25,13 @@
 
 package com.sun.javafx.embed.swing.newimpl;
 
-import com.sun.javafx.embed.swing.JFXPanelInterop;
 import java.awt.AWTEvent;
 import java.awt.Toolkit;
 import java.awt.Window;
 import javafx.embed.swing.JFXPanel;
 import jdk.swing.interop.SwingInterOpUtils;
 
-public class JFXPanelInteropN extends JFXPanelInterop {
+public class JFXPanelInteropN {
     public void postEvent(JFXPanel panel, AWTEvent e) {
         SwingInterOpUtils.postEvent(panel, e);
     }
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/SwingFXUtilsImplInteropN.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/SwingFXUtilsImplInteropN.java	Mon Dec 17 11:35:12 2018 +0530
@@ -26,7 +26,6 @@
 package com.sun.javafx.embed.swing.newimpl;
 
 import com.sun.javafx.application.PlatformImpl;
-import com.sun.javafx.embed.swing.SwingFXUtilsImplInterop;
 import com.sun.javafx.tk.Toolkit;
 import java.awt.EventQueue;
 import java.awt.SecondaryLoop;
@@ -34,7 +33,7 @@
 import javafx.application.Platform;
 import jdk.swing.interop.DispatcherWrapper;
 
-public class SwingFXUtilsImplInteropN extends SwingFXUtilsImplInterop {
+public class SwingFXUtilsImplInteropN {
 
     private static class FwSecondaryLoop implements SecondaryLoop {
 
--- a/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/SwingNodeInteropN.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/newimpl/SwingNodeInteropN.java	Mon Dec 17 11:35:12 2018 +0530
@@ -30,7 +30,6 @@
 import com.sun.javafx.embed.swing.FXDnD;
 import com.sun.javafx.embed.swing.SwingCursors;
 import com.sun.javafx.embed.swing.SwingNodeHelper;
-import com.sun.javafx.embed.swing.SwingNodeInterop;
 import com.sun.javafx.scene.NodeHelper;
 import com.sun.javafx.stage.WindowHelper;
 import com.sun.javafx.util.Utils;
@@ -56,7 +55,7 @@
 import jdk.swing.interop.LightweightContentWrapper;
 import jdk.swing.interop.LightweightFrameWrapper;
 
-public class SwingNodeInteropN extends SwingNodeInterop {
+public class SwingNodeInteropN {
 
     private volatile LightweightFrameWrapper lwFrame;
 
--- a/modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java	Mon Dec 17 11:35:12 2018 +0530
@@ -73,12 +73,11 @@
 import com.sun.javafx.embed.EmbeddedStageInterface;
 import com.sun.javafx.embed.HostInterface;
 
-import com.sun.javafx.embed.swing.InteropFactory;
 import com.sun.javafx.embed.swing.SwingDnD;
 import com.sun.javafx.embed.swing.SwingEvents;
 import com.sun.javafx.embed.swing.SwingCursors;
 import com.sun.javafx.embed.swing.SwingNodeHelper;
-import com.sun.javafx.embed.swing.JFXPanelInterop;
+import com.sun.javafx.embed.swing.newimpl.JFXPanelInteropN;
 
 /**
 * {@code JFXPanel} is a component to embed JavaFX content into
@@ -181,16 +180,7 @@
 
     private static boolean fxInitialized;
 
-    private static InteropFactory iopFactoryInstance = null;
-    private JFXPanelInterop jfxPanelIOP;
-
-    static {
-        try {
-            iopFactoryInstance = InteropFactory.getInstance();
-        } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-        }
-    }
+    private JFXPanelInteropN jfxPanelIOP;
 
     private synchronized void registerFinishListener() {
         if (instanceCount.getAndIncrement() > 0) {
@@ -263,7 +253,7 @@
     public JFXPanel() {
         super();
 
-        jfxPanelIOP = iopFactoryInstance.createJFXPanelImpl();
+        jfxPanelIOP = new JFXPanelInteropN();
         initFx();
 
         hostContainer = new HostContainer();
--- a/modules/javafx.swing/src/main/java/javafx/embed/swing/SwingNode.java	Fri Dec 14 17:01:37 2018 -0800
+++ b/modules/javafx.swing/src/main/java/javafx/embed/swing/SwingNode.java	Mon Dec 17 11:35:12 2018 +0530
@@ -73,8 +73,7 @@
 
 import com.sun.javafx.embed.swing.SwingNodeHelper;
 import com.sun.javafx.embed.swing.SwingEvents;
-import com.sun.javafx.embed.swing.InteropFactory;
-import com.sun.javafx.embed.swing.SwingNodeInterop;
+import com.sun.javafx.embed.swing.newimpl.SwingNodeInteropN;
 
 /**
  * This class is used to embed a Swing content into a JavaFX application.
@@ -119,16 +118,8 @@
  */
 public class SwingNode extends Node {
     private static boolean isThreadMerged;
-    private SwingNodeInterop swNodeIOP;
-    private static InteropFactory iopFactoryInstance = null;
 
     static {
-        try {
-            iopFactoryInstance = InteropFactory.getInstance();
-        } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-        }
-
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 isThreadMerged = Boolean.valueOf(
@@ -258,6 +249,7 @@
     private boolean skipBackwardUnrgabNotification;
     private boolean grabbed; // lwframe initiated grab
     private Timer deactivate; // lwFrame deactivate delay for Linux
+    private SwingNodeInteropN swNodeIOP;
 
     {
         // To initialize the class helper at the begining each constructor of this class
@@ -268,7 +260,7 @@
      * Constructs a new instance of {@code SwingNode}.
      */
     public SwingNode() {
-        swNodeIOP = iopFactoryInstance.createSwingNodeImpl();
+        swNodeIOP = new SwingNodeInteropN();
         setFocusTraversable(true);
         setEventHandler(MouseEvent.ANY, new SwingMouseEventHandler());
         setEventHandler(KeyEvent.ANY, new SwingKeyEventHandler());