1 import javafx.application.Application;
2 import javafx.scene.Scene;
3 import javafx.scene.Group;
4 import javafx.scene.layout.BorderPane;
5 import javafx.scene.paint.Color;
6 import javafx.stage.Stage;
7 import javafx.scene.shape.Arc;
8 import javafx.scene.shape.ArcType;
9 import javafx.scene.text.Text;
10
11 public class ShowArc extends Application {
12 @Override
13 public void start(Stage primaryStage) {
14 Arc arc1 = new Arc(150, 100, 80, 80, 30, 35);
15 arc1.setFill(Color.RED);
16 arc1.setType(ArcType.ROUND);
17
18 Arc arc2 = new Arc(150, 100, 80, 80, 30 + 90, 35);
19 arc2.setFill(Color.WHITE);
20 arc2.setType(ArcType.OPEN);
21 arc2.setStroke(Color.BLACK);
22
23 Arc arc3 = new Arc(150, 100, 80, 80, 30 + 180, 35);
24 arc3.setFill(Color.WHITE);
25 arc3.setType(ArcType.CHORD);
26 arc3.setStroke(Color.BLACK);
27
28 Arc arc4 = new Arc(150, 100, 80, 80, 30 + 270, 35);
29 arc4.setFill(Color.GREEN);
30 arc4.setType(ArcType.CHORD);
31 arc4.setStroke(Color.BLACK);
32
33
34 Group group = new Group();
35 group.getChildren().addAll(new Text(210, 40, "arc1: round"),
36 arc1, new Text(20, 40, "arc2: open"), arc2,
37 new Text(20, 170, "arc3: chord"), arc3,
38 new Text(210, 170, "arc4: chord"), arc4);
39
40
41 Scene scene = new Scene(new BorderPane(group), 300, 200);
42 primaryStage.setTitle("ShowArc");
43 primaryStage.setScene(scene);
44 primaryStage.show();
45 }
46
47
51 public static void main(String[] args) {
52 launch(args);
53 }
54 }