private static Arc createArc(double radius, double centerX, double centerY, double fromAngle, double toAngle, Paint stroke, double strokeWidth) { Arc arc = new Arc(centerX, centerY, radius, radius, fromAngle, toAngle - fromAngle); arc.setFill(null); arc.setStroke(stroke); arc.setStrokeWidth(strokeWidth); return arc; } @Override public void start(Stage primaryStage) { Pane pane = new Pane( createArc(50, 60, 60, 90, 315, Color.BLUE, 10), // part of the blue ring containing part covered by yellow createArc(50, 110, 110, 0, 360, Color.YELLOW, 10), createArc(50, 60, 60, -45, 90, Color.BLUE, 10) // part covering the yellow ring ); Scene scene = new Scene(pane); primaryStage.setScene(scene); primaryStage.show(); }
import javafx.application.Application; import javafx.scene.*; import javafx.scene.paint.Color; import javafx.scene.shape.*; import javafx.stage.Stage; public class SemiCircleSample extends Application { @Override public void start(Stage stage) { Arc arc = new Arc(50, 50, 25, 25, 0, 180); arc.setType(ArcType.OPEN); arc.setStrokeWidth(10); arc.setStroke(Color.CORAL); arc.setStrokeType(StrokeType.INSIDE); arc.setFill(null); stage.setScene(new Scene(new Group(arc), 100, 80)); stage.show(); } public static void main(String[] args) { launch(args); } }
slice.setRadiusY(radius); slice.setType(ArcType.ROUND); slice.setFill(data.getColor()); slice.setStartAngle(totalAngle); @Override public void handle(MouseEvent event) { slice.setFill(data.getColor().brighter()); tooltip.show(slice, event.getScreenX()+10, event.getScreenY()+10); @Override public void handle(MouseEvent event) { slice.setFill(data.getColor()); tooltip.hide(); sep.setRadiusY(radius+1); sep.setType(ArcType.ROUND); sep.setFill(separatorColor); sep.setLength(-separatorLength); hole.setRadiusY(innerHoleRadius); hole.setType(ArcType.ROUND); hole.setFill(holeColor); hole.setStartAngle(0); hole.setLength(180);
arc.setFill(null);