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:
![Draw Square in javaFx](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV5FYahcaX-uxmn2gqfescAxrKjqVZYOlSVk2qzO-RZf1ROjW6EV6myV6MH0J5cRDJQzRQvACFAEkHQnwqG4K7Jitw73WP_p7gIVS1d67NAp3uBrQIwhAf38UvkB1rZPIuUQ9GcTiVQx4/s72-c/Javafx_logo_color.png)
No comments: