Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The picture you linked is actually a semi-ring. You can get it in JavaFX by drawing nested 2 arcs and some lines. But my preferred way is to use the <code>Path</code>.</p> <pre><code>public class SemiDemo extends Application { @Override public void start(Stage primaryStage) { Group root = new Group(); root.getChildren().add(drawSemiRing(120, 120, 100, 50, Color.LIGHTGREEN, Color.DARKGREEN)); root.getChildren().add(drawSemiRing(350, 350, 200, 30, Color.LIGHTSKYBLUE, Color.DARKBLUE)); Scene scene = new Scene(root, 300, 250); primaryStage.setScene(scene); primaryStage.show(); } private Path drawSemiRing(double centerX, double centerY, double radius, double innerRadius, Color bgColor, Color strkColor) { Path path = new Path(); path.setFill(bgColor); path.setStroke(strkColor); path.setFillRule(FillRule.EVEN_ODD); MoveTo moveTo = new MoveTo(); moveTo.setX(centerX + innerRadius); moveTo.setY(centerY); ArcTo arcToInner = new ArcTo(); arcToInner.setX(centerX - innerRadius); arcToInner.setY(centerY); arcToInner.setRadiusX(innerRadius); arcToInner.setRadiusY(innerRadius); MoveTo moveTo2 = new MoveTo(); moveTo2.setX(centerX + innerRadius); moveTo2.setY(centerY); HLineTo hLineToRightLeg = new HLineTo(); hLineToRightLeg.setX(centerX + radius); ArcTo arcTo = new ArcTo(); arcTo.setX(centerX - radius); arcTo.setY(centerY); arcTo.setRadiusX(radius); arcTo.setRadiusY(radius); HLineTo hLineToLeftLeg = new HLineTo(); hLineToLeftLeg.setX(centerX - innerRadius); path.getElements().add(moveTo); path.getElements().add(arcToInner); path.getElements().add(moveTo2); path.getElements().add(hLineToRightLeg); path.getElements().add(arcTo); path.getElements().add(hLineToLeftLeg); return path; } public static void main(String[] args) { launch(args); } } </code></pre> <p>Refer to <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/shape/package-summary.html" rel="noreferrer">Shape API</a> of JavaFX for more info about the shapes used in the code.<br> Screenshot:</p> <p><img src="https://i.stack.imgur.com/3HjgR.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload