47 lines
1.4 KiB
Java
47 lines
1.4 KiB
Java
/*
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
*/
|
|
package javafx_calebfontenot;
|
|
|
|
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.stage.Stage;
|
|
|
|
/**
|
|
*
|
|
* @author caleb
|
|
*/
|
|
public class ShowCircleCentered extends Application {
|
|
|
|
@Override
|
|
public void start(Stage primaryStage)
|
|
{
|
|
// Create a pane to hold the Circle
|
|
Pane pane = new Pane();
|
|
|
|
// Create a circle and set its properties
|
|
Circle circle = new Circle();
|
|
circle.centerXProperty().bind(pane.widthProperty().divide(2));
|
|
circle.centerYProperty().bind(pane.heightProperty().divide(2));
|
|
circle.setRadius(50);
|
|
circle.setStroke(Color.BLACK);
|
|
circle.setFill(Color.WHITE);
|
|
pane.getChildren().add(circle); // Add the circle to the pane
|
|
|
|
// Create a scene and place it in the stage
|
|
Scene scene = new Scene(pane, 200, 200);
|
|
primaryStage.setTitle("ShowCircleCentered"); // Set the stage title
|
|
primaryStage.setScene(scene); // Place the scene in the stage
|
|
primaryStage.show(); // Display the stage
|
|
}
|
|
public static void main(String[] args)
|
|
{
|
|
launch(args);
|
|
}
|
|
|
|
}
|