/************************************************** * Author: Morrison * Date: 09 May 2022 **************************************************/ import javafx.application.Application; import javafx.application.Platform; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; public class Draw extends Application { public Draw() { } @Override public void init() { } @Override public void start(Stage primary) { BorderPane bp = new BorderPane(); Canvas c = new Canvas(500,500); GraphicsContext pen = c.getGraphicsContext2D(); bp.setCenter(c); pen.setFill(Color.web("#001A57")); pen.fillRect(100,100, 50, 50); primary.setScene(new Scene(bp)); primary.show(); } @Override public void stop() { } }