import java.util.*; import java.util.zip.*; import java.util.List; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.table.*; import java.io.*; import java.net.*; import java.lang.reflect.*; import java.lang.ref.*; import java.lang.management.*; import java.security.*; import java.security.spec.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.imageio.*; import java.math.*; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.embed.swing.SwingNode; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class main extends Application { public static void main(String[] args) throws Exception { fixContextClassLoader(); launch(); } public void start(Stage stage) { SwingNode swingNode = new SwingNode(); createSwingContent(swingNode); StackPane pane = new StackPane(); pane.getChildren().add(swingNode); stage.setTitle("Swing in JavaFX"); stage.setScene(new Scene(pane, 250, 150)); stage.show(); } void createSwingContent(final SwingNode swingNode) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { swingNode.setContent(new JButton("Click me!")); } catch (Exception _e) { throw _e instanceof RuntimeException ? (RuntimeException) _e : new RuntimeException(_e); } } }); } static void fixContextClassLoader() { Thread.currentThread().setContextClassLoader(myClassLoader()); } static ClassLoader myClassLoader() { return mc().getClassLoader(); } static Class mc() { return getMainClass(); } static Class getMainClass() { try { return Class.forName("main"); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static Class getMainClass(Object o) { try { return (o instanceof Class ? (Class) o : o.getClass()).getClassLoader().loadClass("main"); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} }