2023-04-13 20:08:31 -05:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
< html >
< head >
< title > ShowCircleCentered.java< / title >
< meta http-equiv = "content-type" content = "text/html; charset=UTF-8" >
< style type = "text/css" >
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
table {color: #888888; background-color: #313335; font-family: monospace}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
2023-08-14 11:41:26 -05:00
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
2023-04-13 20:08:31 -05:00
.literal {color: #cc7832}
-->
< / style >
< / head >
< body >
< table width = "100%" > < tr > < td align = "center" > /home/caleb/ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/src/javafx_calebfontenot/ShowCircleCentered.java< / td > < / tr > < / table >
< pre >
< span class = "comment" > /*< / span >
2023-08-14 11:41:26 -05:00
< span class = "comment" > * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license< / span >
< span class = "comment" > * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template< / span >
2023-04-13 20:08:31 -05:00
< span class = "comment" > */< / span >
< span class = "literal" > package< / span > javafx_calebfontenot;
< span class = "literal" > import< / span > javafx.application.Application;
< span class = "literal" > import< / span > javafx.scene.Scene;
< span class = "literal" > import< / span > javafx.scene.layout.Pane;
< span class = "literal" > import< / span > javafx.scene.paint.Color;
< span class = "literal" > import< / span > javafx.scene.shape.Circle;
< span class = "literal" > import< / span > javafx.stage.Stage;
< span class = "comment" > /**< / span >
< span class = "comment" > *< / span >
2023-08-14 11:41:26 -05:00
< span class = "comment" > * < / span > < span class = "ST0" > @author< / span > < span class = "comment" > caleb< / span >
2023-04-13 20:08:31 -05:00
< span class = "comment" > */< / span >
< span class = "literal" > public< / span > < span class = "literal" > class< / span > ShowCircleCentered < span class = "literal" > extends< / span > Application {
@Override
2023-08-14 11:41:26 -05:00
< span class = "literal" > public< / span > < span class = "literal" > void< / span > start(Stage primaryStage)
2023-04-13 20:08:31 -05:00
{
< span class = "comment" > // Create a pane to hold the Circle< / span >
Pane pane = < span class = "literal" > new< / span > Pane();
< span class = "comment" > // Create a circle and set its properties< / span >
Circle circle = < span class = "literal" > new< / span > Circle();
circle.centerXProperty().bind(pane.widthProperty().divide(< span class = "number" > 2< / span > ));
circle.centerYProperty().bind(pane.heightProperty().divide(< span class = "number" > 2< / span > ));
2023-08-14 11:41:26 -05:00
circle.setRadius(< span class = "number" > 50< / span > );
circle.setStroke(Color.BLACK);
circle.setFill(Color.WHITE);
2023-04-13 20:08:31 -05:00
pane.getChildren().add(circle); < span class = "comment" > // Add the circle to the pane< / span >
< span class = "comment" > // Create a scene and place it in the stage< / span >
2023-08-14 11:41:26 -05:00
Scene scene = < span class = "literal" > new< / span > Scene(pane, < span class = "number" > 200< / span > , < span class = "number" > 200< / span > );
2023-04-13 20:08:31 -05:00
primaryStage.setTitle(< span class = "string" > " < / span > < span class = "string" > ShowCircleCentered< / span > < span class = "string" > " < / span > ); < span class = "comment" > // Set the stage title< / span >
primaryStage.setScene(scene); < span class = "comment" > // Place the scene in the stage< / span >
primaryStage.show(); < span class = "comment" > // Display the stage< / span >
}
2023-08-14 11:41:26 -05:00
< span class = "literal" > public< / span > < span class = "literal" > static< / span > < span class = "literal" > void< / span > main(String[] args)
2023-04-13 20:08:31 -05:00
{
2023-08-14 11:41:26 -05:00
launch(args);
2023-04-13 20:08:31 -05:00
}
}
< / pre > < / body >
< / html >