Search in sources :

Example 11 with SwingNode

use of javafx.embed.swing.SwingNode in project TeachingInSimulation by ScOrPiOzzy.

the class WordViewerTest method start.

@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.initStyle(StageStyle.TRANSPARENT);
    SWTPanel swt = new SWTPanel();
    swt.setSize(1366, 768);
    JPanel panel = new JPanel();
    panel.setSize(1366, 768);
    panel.add(swt);
    SwingNode node = new SwingNode();
    node.setContent(panel);
    StackPane root = new StackPane(node);
    Scene scene = new Scene(root);
    scene.setFill(null);
    primaryStage.setScene(scene);
    primaryStage.setWidth(1366);
    primaryStage.setHeight(768);
    primaryStage.show();
}
Also used : JPanel(javax.swing.JPanel) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane) SwingNode(javafx.embed.swing.SwingNode)

Example 12 with SwingNode

use of javafx.embed.swing.SwingNode in project dwoss by gg-net.

the class FxCore method wrap.

public static SwingNode wrap(final JPanel p) throws ExecutionException, InterruptedException, InvocationTargetException {
    return SwingSaft.dispatch(() -> {
        SwingNode swingNode = new SwingNode();
        swingNode.setContent(p);
        return swingNode;
    });
}
Also used : SwingNode(javafx.embed.swing.SwingNode)

Example 13 with SwingNode

use of javafx.embed.swing.SwingNode in project dwoss by gg-net.

the class BuilderUtil method wrapJPanel.

/**
 * Call from EventQueue: Wraps the expected uiparameter.jpanel in the expected pane with a swingnode as children.
 * Also updates the global parent mapping and the prefered size of the pane
 *
 * @param in the uiparamter
 * @return the uiparamter
 */
static UiParameter wrapJPanel(UiParameter in) {
    Objects.requireNonNull(in.getPane(), "Pane in UiParameter is null");
    Objects.requireNonNull(in.getJPanel(), "JPanel in UiParameter is null");
    if (in.getPane().getChildren().isEmpty())
        throw new IllegalStateException("Supplied Pane has no children, but a SwingNode is expected");
    SwingNode sn = in.getPane().getChildren().stream().filter(n -> n instanceof SwingNode).map(n -> (SwingNode) n).findAny().orElseThrow(() -> new IllegalStateException("No Node of the supplied Pane is of type SwingNode"));
    sn.setContent(in.getJPanel());
    StaticParentMapperJavaFx.map(in.getJPanel(), sn);
    Dimension preferredSize = in.getJPanel().getPreferredSize();
    L.debug("Setting Swing Size to JavaFx {}", preferredSize);
    in.getPane().setPrefHeight(preferredSize.getHeight());
    in.getPane().setPrefWidth(preferredSize.getWidth());
    return in;
}
Also used : Button(javafx.scene.control.Button) Scene(javafx.scene.Scene) java.util(java.util) ModalityType(java.awt.Dialog.ModalityType) LoggerFactory(org.slf4j.LoggerFactory) JFXPanel(javafx.embed.swing.JFXPanel) ResultProducer(eu.ggnet.saft.api.ui.ResultProducer) FxController(eu.ggnet.saft.api.ui.FxController) FxSaft.loadView(eu.ggnet.saft.core.ui.FxSaft.loadView) FXMLLoader(javafx.fxml.FXMLLoader) eu.ggnet.saft.core.ui(eu.ggnet.saft.core.ui) Type(eu.ggnet.saft.core.ui.builder.UiWorkflowBreak.Type) WeakReference(java.lang.ref.WeakReference) Pane(javafx.scene.layout.Pane) Color(javafx.scene.paint.Color) Dialog(javafx.scene.control.Dialog) Logger(org.slf4j.Logger) java.util.concurrent(java.util.concurrent) IOException(java.io.IOException) WindowAdapter(java.awt.event.WindowAdapter) Collectors(java.util.stream.Collectors) WindowEvent(java.awt.event.WindowEvent) java.awt(java.awt) Stage(javafx.stage.Stage) BorderPane(javafx.scene.layout.BorderPane) Image(javafx.scene.image.Image) eu.ggnet.saft(eu.ggnet.saft) SwingNode(javafx.embed.swing.SwingNode) javax.swing(javax.swing) SwingNode(javafx.embed.swing.SwingNode)

Aggregations

SwingNode (javafx.embed.swing.SwingNode)13 BorderPane (javafx.scene.layout.BorderPane)6 Scene (javafx.scene.Scene)4 JScrollPane (javax.swing.JScrollPane)4 Button (javafx.scene.control.Button)3 Label (javafx.scene.control.Label)3 Tab (javafx.scene.control.Tab)3 IOException (java.io.IOException)2 Insets (javafx.geometry.Insets)2 eu.ggnet.saft (eu.ggnet.saft)1 FxController (eu.ggnet.saft.api.ui.FxController)1 ResultProducer (eu.ggnet.saft.api.ui.ResultProducer)1 eu.ggnet.saft.core.ui (eu.ggnet.saft.core.ui)1 FxSaft.loadView (eu.ggnet.saft.core.ui.FxSaft.loadView)1 Type (eu.ggnet.saft.core.ui.builder.UiWorkflowBreak.Type)1 Layer (fractal.Layer)1 Palette (fractal.Palette)1 RenderManager (fractal.RenderManager)1 java.awt (java.awt)1 AWTException (java.awt.AWTException)1