JavaFX Arc create

Description

JavaFX Arc create


import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import javafx.stage.Stage;

public class Main extends Application {
  public static void main(String[] args) {
    Application.launch(args);/*from  w  w  w.ja  v  a 2s .  co m*/
  }

  @Override
  public void start(Stage stage) {
    // 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(arc);
    root.setSpacing(10);

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



PreviousNext

Related