41 lines
1.6 KiB
Java
41 lines
1.6 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 static javafx.application.Application.launch;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.layout.Pane;
|
|
import javafx.scene.paint.Color;
|
|
import javafx.scene.shape.Rectangle;
|
|
import javafx.stage.Stage;
|
|
|
|
/**
|
|
*
|
|
* @author caleb
|
|
*/
|
|
public class ShowRectangle extends Application {
|
|
|
|
@Override
|
|
public void start(Stage primaryStage)
|
|
{
|
|
Pane pane = new Pane(); // Create a pane object
|
|
Scene scene = new Scene(pane, 300, 200); // Create a scene object
|
|
primaryStage.setScene(scene); // Set the stage scene to the scene object
|
|
primaryStage.show(); // Make the window display on the screen
|
|
Rectangle r = new Rectangle(30, 30, 88, 44);
|
|
r.setX(30);
|
|
r.setY(30);
|
|
r.setStroke(Color.BLUE); // Set the rectangle outline to Blue
|
|
r.setFill(Color.RED); // Set the interior of the rectangle to Red
|
|
pane.getChildren().add(r); // Add the circle object to the pane
|
|
}
|
|
|
|
public static void main(String[] args)
|
|
{
|
|
launch(args);
|
|
}
|
|
}
|