import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; import javafx.stage.Stage; public class SimplePutArgb extends Application { @Override public void start(Stage stage) { Canvas cv = new Canvas(300, 300); GraphicsContext gc = cv.getGraphicsContext2D(); gc.setFill(Color.rgb(255, 0, 0, 0.5)); gc.fillRect(50, 25, 50, 250); gc.setFill(Color.rgb(0, 0, 255, 0.5)); gc.fillRect(25, 125, 100, 50); gc.getPixelWriter().setArgb(150, 150, 0xff00ff00); gc.setFill(Color.rgb(255, 0, 0, 0.5)); gc.fillRect(200, 25, 50, 250); gc.setFill(Color.rgb(0, 0, 255, 0.5)); gc.fillRect(175, 125, 100, 50); Scene scene = new Scene(new Group(cv)); stage.setScene(scene); stage.show(); } }