Search in sources :

Example 31 with JFXPanel

use of javafx.embed.swing.JFXPanel in project ETUmulator by kasirgalabs.

the class GUISafeDispatcherTest method testNotifyObservers.

/**
 * Test of notifyObservers method, of class GUISafeDispatcher.
 *
 * @throws java.lang.InterruptedException
 */
@Test
public void testNotifyObservers() throws InterruptedException {
    assert !Platform.isFxApplicationThread();
    new JFXPanel();
    dispatcher.addObserver(this);
    latch = new CountDownLatch(1);
    dispatcher.notifyObservers(null);
    latch.await(5, TimeUnit.SECONDS);
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Example 32 with JFXPanel

use of javafx.embed.swing.JFXPanel in project contentment by GeePawHill.

the class ContentmentTest method runJavaFx.

protected void runJavaFx() throws InterruptedException {
    if (javaFxRunning)
        return;
    long timeMillis = System.currentTimeMillis();
    final CountDownLatch latch = new CountDownLatch(1);
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            forceJavaFxStart();
            latch.countDown();
        }

        private void forceJavaFxStart() {
            new JFXPanel();
        }
    });
    System.out.println("javafx initialising...");
    latch.await();
    System.out.println("javafx is initialised in " + (System.currentTimeMillis() - timeMillis) + "ms");
    javaFxRunning = true;
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 33 with JFXPanel

use of javafx.embed.swing.JFXPanel in project gs-ui-javafx by graphstream.

the class FxFileSinkImages method initImage.

@Override
protected void initImage() {
    // 
    // Little hack to initialize JavaFX Toolkit.
    // 
    new JFXPanel();
    image = new WritableImage(resolution.getWidth(), resolution.getHeight());
    canvas = new Canvas(resolution.getWidth(), resolution.getHeight());
}
Also used : WritableImage(javafx.scene.image.WritableImage) JFXPanel(javafx.embed.swing.JFXPanel) Canvas(javafx.scene.canvas.Canvas)

Example 34 with JFXPanel

use of javafx.embed.swing.JFXPanel in project BlocklyArduinoIDEPlugin by technologiescollege.

the class LedMatrixPlugin method initGUI.

private void initGUI() {
    window = new JFrame();
    window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    window.setLayout(new BorderLayout());
    window.setSize(1024, 768);
    window.setLocationRelativeTo(null);
    window.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            SwingUtilities.invokeLater(() -> {
                Platform.runLater(() -> {
                    // browser.webEngine.load("about:blank");
                    SwingUtilities.invokeLater(() -> {
                        // System.out.println("test");
                        try {
                            e.getWindow().dispose();
                        } catch (NullPointerException ex) {
                        // System.out.println("This is a bug in java: https://bugs.openjdk.java.net/browse/JDK-8089371");
                        }
                    });
                });
            });
        }
    });
    jfxPanel = new JFXPanel();
    jfxPanel.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
    window.add(jfxPanel, BorderLayout.CENTER);
    window.setVisible(true);
    Platform.runLater(() -> {
        showBrowser();
    });
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension)

Example 35 with JFXPanel

use of javafx.embed.swing.JFXPanel in project BlocklyArduinoIDEPlugin by technologiescollege.

the class StartupApplet method init.

@Override
public void init() {
    LedMatrixPlugin.startTimestamp = System.currentTimeMillis();
    fxContainer = new JFXPanel();
    fxContainer.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
    add(fxContainer, BorderLayout.CENTER);
    Platform.setImplicitExit(false);
    Runnable activeRunnable = new Runnable() {

        @Override
        public void run() {
            createScene();
        }
    };
    Platform.runLater(activeRunnable);
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) Dimension(java.awt.Dimension)

Aggregations

JFXPanel (javafx.embed.swing.JFXPanel)50 Scene (javafx.scene.Scene)16 Test (org.junit.Test)16 CountDownLatch (java.util.concurrent.CountDownLatch)11 Dimension (java.awt.Dimension)6 BorderPane (javafx.scene.layout.BorderPane)6 Stage (javafx.stage.Stage)6 FXMLLoader (javafx.fxml.FXMLLoader)5 WebView (javafx.scene.web.WebView)5 BaseDocumentTest (com.kasirgalabs.etumulator.document.BaseDocumentTest)4 BorderLayout (java.awt.BorderLayout)4 WindowAdapter (java.awt.event.WindowAdapter)4 WindowEvent (java.awt.event.WindowEvent)4 ExecutorService (java.util.concurrent.ExecutorService)4 JFrame (javax.swing.JFrame)4 WebEngine (javafx.scene.web.WebEngine)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 Random (java.util.Random)2 FutureTask (java.util.concurrent.FutureTask)2 Memory (php.runtime.Memory)2