package demo; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Ellipse; import javafx.scene.shape.Rectangle; import javafx.scene.shape.Shape; import javafx.stage.Stage; public class BugShapeStroke extends Application { public static void main(String[] args) { launch(args); } Group root = new Group(); private void init(Stage primaryStage) { primaryStage.setScene(new Scene(root)); primaryStage.setHeight(250); } @Override public void start(Stage primaryStage) throws Exception { init(primaryStage); primaryStage.show(); root.getChildren().add(drawNode()); } public Shape createShape() { Rectangle rect = new Rectangle(); rect.setWidth(100.0f); rect.setHeight(50.0f); Ellipse ellipse = new Ellipse(); ellipse.setCenterX(100.0f); ellipse.setCenterY(25.0f); ellipse.setRadiusX(50.0f); ellipse.setRadiusY(25.0f); Shape ss = javafx.scene.shape.Path.subtract(rect, ellipse); return ss; }; BorderPane borderPane; Button bLeft; protected Pane baseFill(Pane pane) { pane.setPrefSize(180, 190); pane.setStyle("-fx-border-color: darkgray;"); return pane; } public Node drawNode() { final Pane vb = new VBox(); final Shape sh = createShape(); vb.getChildren().add(sh); sh.setStroke(Color.GREEN); sh.setFill(Color.YELLOW); vb.setLayoutX(20); vb.setLayoutY(20); return baseFill(vb); } }