> package application;
>
> import java.io.IOException;
>
> import javafx.application.ConditionalFeature;
> import javafx.application.Platform;
> import javafx.embed.swt.FXCanvas;
> import javafx.event.ActionEvent;
> import javafx.event.EventHandler;
> import javafx.fxml.FXMLLoader;
> import javafx.scene.Parent;
> import javafx.scene.Scene;
> import javafx.scene.control.Button;
> import javafx.scene.control.ContextMenu;
> import javafx.scene.control.MenuItem;
> import javafx.scene.control.TextArea;
> import javafx.scene.layout.HBox;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
>
> /**
> * @author tomschindl
> *
> */
> public class TestFXSWT {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> Display d = new Display();
> Shell s = new Shell();
> s.setLayout(new FillLayout());
>
> final FXCanvas c = new FXCanvas(s, SWT.NONE);
>
> HBox b = new HBox();
> Button bu = new Button("Hello World");
> bu.setContextMenu(new ContextMenu(new MenuItem("Hello Menu")));
> bu.setOnAction(new EventHandler<ActionEvent>() {
>
> @Override
> public void handle(ActionEvent event) {
> HBox b1 = new HBox();
> b1.getChildren().add(new Button("New one"));
> c.setScene(new Scene(b1,1000,1000,Platform.isSupported(ConditionalFeature.SCENE3D)));
> }
> });
> b.getChildren().add(bu);
> c.setScene(new Scene(b,1000,1000,Platform.isSupported(ConditionalFeature.SCENE3D)));
>
> s.setSize(500, 500);
> s.open();
> while( ! s.isDisposed() ) {
> if(! d.readAndDispatch()) {
> d.sleep();
> }
> }
>
> d.dispose();
> }
>
> }
>
> import java.io.IOException;
>
> import javafx.application.ConditionalFeature;
> import javafx.application.Platform;
> import javafx.embed.swt.FXCanvas;
> import javafx.event.ActionEvent;
> import javafx.event.EventHandler;
> import javafx.fxml.FXMLLoader;
> import javafx.scene.Parent;
> import javafx.scene.Scene;
> import javafx.scene.control.Button;
> import javafx.scene.control.ContextMenu;
> import javafx.scene.control.MenuItem;
> import javafx.scene.control.TextArea;
> import javafx.scene.layout.HBox;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
>
> /**
> * @author tomschindl
> *
> */
> public class TestFXSWT {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> Display d = new Display();
> Shell s = new Shell();
> s.setLayout(new FillLayout());
>
> final FXCanvas c = new FXCanvas(s, SWT.NONE);
>
> HBox b = new HBox();
> Button bu = new Button("Hello World");
> bu.setContextMenu(new ContextMenu(new MenuItem("Hello Menu")));
> bu.setOnAction(new EventHandler<ActionEvent>() {
>
> @Override
> public void handle(ActionEvent event) {
> HBox b1 = new HBox();
> b1.getChildren().add(new Button("New one"));
> c.setScene(new Scene(b1,1000,1000,Platform.isSupported(ConditionalFeature.SCENE3D)));
> }
> });
> b.getChildren().add(bu);
> c.setScene(new Scene(b,1000,1000,Platform.isSupported(ConditionalFeature.SCENE3D)));
>
> s.setSize(500, 500);
> s.open();
> while( ! s.isDisposed() ) {
> if(! d.readAndDispatch()) {
> d.sleep();
> }
> }
>
> d.dispose();
> }
>
> }