import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class AbsoluteLayoutEx extends Application {
public void start(Stage stage) {
initUI(stage);
}
private void initUI(Stage stage) {
Pane root = new Pane();
Rectangle rect = new Rectangle(25, 25, 50, 50);
rect.setFill(Color.CADETBLUE);
Line line = new Line(90, 40, 230, 40);
line.setStroke(Color.RED);
Circle circle = new Circle(130, 130, 30);
circle.setFill(Color.CHOCOLATE);
root.getChildren().addAll(rect, line, circle);
Scene scene = new Scene(root, 250, 220, Color.WHITESMOKE);
stage.setTitle("Absolute layout");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class AbsoluteLayoutEx extends Application {
public void start(Stage stage) {
initUI(stage);
}
private void initUI(Stage stage) {
Pane root = new Pane();
Rectangle rect = new Rectangle(25, 25, 50, 50);
rect.setFill(Color.CADETBLUE);
Line line = new Line(90, 40, 230, 40);
line.setStroke(Color.RED);
Circle circle = new Circle(130, 130, 30);
circle.setFill(Color.CHOCOLATE);
root.getChildren().addAll(rect, line, circle);
Scene scene = new Scene(root, 250, 220, Color.WHITESMOKE);
stage.setTitle("Absolute layout");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
No comments:
Post a Comment