Java Circle() Constructor

Syntax

Circle() constructor from Circle has the following syntax.

public Circle()

Example

In the following code shows how to use Circle.Circle() constructor.


// ww  w.ja  v  a  2s .  com
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.effect.DropShadow;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Main extends Application {
  public static void main(String[] args) {
    Application.launch(args);
  }

  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds1 = new DropShadow();
    ds1.setOffsetY(4.0);

    Circle c = new Circle();
    c.setEffect(ds1);
    c.setCenterX(50.0);
    c.setCenterY(125.0);
    c.setRadius(30.0);
    c.setFill(Color.RED);
    c.setCache(true);


    g.getChildren().add(c);
    

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
}




















Home »
  Java Tutorial »
    javafx.scene.shape »




Arc
ArcBuilder
Circle
Ellipse
Line
Polygon
VLineTo