Example usage for javafx.scene.shape Circle Circle

List of usage examples for javafx.scene.shape Circle Circle

Introduction

In this page you can find the example usage for javafx.scene.shape Circle Circle.

Prototype

public Circle(double radius) 

Source Link

Document

Creates a new instance of Circle with a specified radius.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Title");

    final Circle circ = new Circle(40);
    final Group root = new Group(circ);
    final Scene scene = new Scene(root, 400, 300);

    primaryStage.setScene(scene);//from  www . ja va 2 s.  c  o m
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Circle circle = new Circle(40);
    circle.setFill(Color.RED);/* w  w  w .  ja v  a  2s .  c o  m*/
    circle.setStroke(Color.BLACK);
    circle.setStrokeWidth(2.0);

    Rectangle rect = new Rectangle(120, 75);
    rect.setFill(Color.RED);

    // Create a line
    Line line = new Line(0, 0, 150, 50);
    line.setStrokeWidth(5.0);
    line.setStroke(Color.GREEN);

    // Create a parallelogram
    Polygon parallelogram = new Polygon();
    parallelogram.getPoints().addAll(30.0, 0.0, 130.0, 0.0, 120.00, 50.0, 0.0, 50.0);
    parallelogram.setFill(Color.AZURE);
    parallelogram.setStroke(Color.BLACK);

    // Create a hexagon
    Polyline hexagon = new Polyline(100.0, 0.0, 120.0, 20.0, 110.0, 140.0, 100.0, 60.0, 80.0, 40.0, 80.0, 120.0,
            100.0, 0.0);
    hexagon.setFill(Color.WHITE);
    hexagon.setStroke(Color.BLACK);

    // A CHORD arc with no fill and a stroke
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.TRANSPARENT);
    arc.setStroke(Color.BLACK);
    arc.setType(ArcType.CHORD);

    // Add all shapes to an HBox
    HBox root = new HBox(circle, rect, line, parallelogram, hexagon, arc);
    root.setSpacing(10);
    root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;"
            + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;");

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("2D Shapes");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    TextField fName = new TextField();
    TextField lName = new TextField();
    TextField salary = new TextField();

    marker = new Circle(5);
    marker.setManaged(false);//from w w w.j  a v  a2 s .c o m
    marker.setFill(Color.RED);
    marker.setMouseTransparent(true);

    HBox hb1 = new HBox();
    HBox hb2 = new HBox();
    HBox hb3 = new HBox();
    hb1.getChildren().addAll(new Label("First Name:"), fName);
    hb2.getChildren().addAll(new Label("Last Name:"), lName);
    hb3.getChildren().addAll(new Label("Salary:"), salary);

    VBox root = new VBox();
    root.getChildren().addAll(hb1, hb2, hb3, marker);

    Scene scene = new Scene(root);

    scene.focusOwnerProperty().addListener((prop, oldNode, newNode) -> placeMarker(newNode));

    stage.setScene(scene);
    stage.setTitle("");
    stage.show();
}