JavaFX / SWT Integration : SWT « JavaFX « Java

JavaFX / SWT Integration

import javafx.embed.swt.FXCanvas;
import javafx.scene.Scene;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Main
   public static void main(String[] arguments)
      final Display display = new Display();
      final Shell shell = new Shell(display);

      shell.setLayout(new FillLayout());
      final FXCanvas canvas = new FXCanvas(shell, SWT.NONE);
      final Scene scene = TextIntegrationSceneCreator.createTextScene();
      while (!shell.isDisposed())
         if (!display.readAndDispatch()) display.sleep();


Related examples in the same category

1.SWT and JavaFX