import javafx.application.Application; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import com.jyloo.syntheticafx.CanvasPane; import com.jyloo.syntheticafx.RootPane; import com.jyloo.syntheticafx.SyntheticaFX; public class CanvasPaneDemo extends Application { @Override public void start(Stage primaryStage) throws Exception { //SyntheticaFX.init("com.jyloo.syntheticafx.SyntheticaFXModena"); SyntheticaFX.init("com.jyloo.syntheticafx.SyntheticaFXStandard"); Scene scene = new Scene(new RootPane(primaryStage, createContent()), 600, 400); primaryStage.setScene(scene); primaryStage.setTitle(getClass().getSimpleName()); primaryStage.show(); } private Parent createContent() { CanvasPane cp = new CanvasPane(); cp.setStyle("-fx-background-color:#FF7; -fx-padding:10 20 30 40"); cp.setDrawHandler((p, g, x, y, w, h) -> { g.setFill(Color.gray(0.5, 0.5)); g.fillRect(x, y, w, h); g.setStroke(Color.RED); g.strokeLine(x, y, x+w, y+h); g.strokeLine(x, y+h, x+w, y); }); return cp; } public static void main(String[] args) { launch(args); } }