Source of ShowCircle.java


  1: 
  2: import javafx.application.Application;
  3: import javafx.scene.Scene;
  4: import javafx.scene.layout.Pane;
  5: import javafx.scene.paint.Color;
  6: import javafx.scene.shape.Circle;
  7: import javafx.stage.Stage;
  8: 
  9: public class ShowCircle extends Application {
 10:   @Override // Override the start method in the Application class
 11:   public void start(Stage primaryStage) {
 12:     // Create a circle and set its properties
 13:     Circle circle = new Circle();
 14:     circle.setCenterX(100);
 15:     circle.setCenterY(100);
 16:     circle.setRadius(50);
 17:     circle.setStroke(Color.BLACK);
 18:     circle.setFill(null);
 19: 
 20:     // Create a pane to hold the circle
 21:     Pane pane = new Pane();
 22:     pane.getChildren().add(circle);
 23: 
 24:     // Create a scene and place it in the stage
 25:     Scene scene = new Scene(pane, 200, 200);
 26:     primaryStage.setTitle("ShowCircle"); // Set the stage title
 27:     primaryStage.setScene(scene); // Place the scene in the stage
 28:     primaryStage.show(); // Display the stage
 29:   }
 30: 
 31:   /**
 32:    * The main method is only needed for the IDE with limited
 33:    * JavaFX support. Not needed for running from the command line.
 34:    */
 35:   public static void main(String[] args) {
 36:     launch(args);
 37:   }
 38: }