ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/Printed HTMLs/ShowCircleCentered.html
2023-08-14 11:41:26 -05:00

72 lines
3.5 KiB
HTML

<!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}
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
.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>
<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>
<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>
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> ShowCircleCentered <span class="literal">extends</span> Application {
@Override
<span class="literal">public</span> <span class="literal">void</span> start(Stage primaryStage)
{
<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>));
circle.setRadius(<span class="number">50</span>);
circle.setStroke(Color.BLACK);
circle.setFill(Color.WHITE);
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>
Scene scene = <span class="literal">new</span> Scene(pane, <span class="number">200</span>, <span class="number">200</span>);
primaryStage.setTitle(<span class="string">&quot;</span><span class="string">ShowCircleCentered</span><span class="string">&quot;</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>
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
launch(args);
}
}
</pre></body>
</html>