package application;

import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.DPIUtil;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import javafx.embed.swt.FXCanvas;

public class MainSWT {

	public static void main(String[] args) {
		Display d = new Display();
		System.err.println("DPI: " + d.getDPI());
		System.err.println("Device-Zoom"+ DPIUtil.getDeviceZoom());

		Shell s = new Shell(d);
		String property = System.getProperty("swt.autoScale");
		boolean autoScale = property == null || Boolean.parseBoolean(property);
		s.setText("FX in SWT - " + System.getProperty("java.version")+" - -Dswt.autoScale=" + autoScale);
		s.setLayout(new FillLayout());

		FXCanvas c = new FXCanvas(s, SWT.NONE);
		c.setScene(Main.createScene());

		s.open();

		while( ! s.isDisposed() ) {
			if(! d.readAndDispatch()) {
				d.sleep();
			}
		}

		d.dispose();
	}

}
