package javafxtest;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
public class Grphicsss extends Application {
@Override public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 300, 300);
scene.setFill(Color.LIGHTGRAY);
Rectangle rectangle= new Rectangle(100, 100, 100,100);
rectangle.setFill(Color.RED);
root.getChildren().add(rectangle);
stage.setScene(scene);
stage.setTitle("Rectangle");
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
OUtPUT :
Draw Square in javaFx
Reviewed by Unknown
on
2:22 pm
Rating:
No comments: