Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8094685

StrokeDashArray with zero length dash has artifact if StrokeLineCap is SQUARE or ROUND

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 8u40
    • javafx
    • None

      I would expect a line with a strokeDashArray of 30, 15, 0, 15 to not show any line at all for the zero length 'pen down' dash. But it does if the StrokeLineCap is SQUARE or ROUND. It does not if the StrokeLineCap is BUTT.

          @Override
          public void start(Stage primaryStage) throws Exception {

              Line line = new Line(0,0,150,0);
              line.getStrokeDashArray().setAll(30d, 15d, 0d, 15d);
              line.setStrokeLineCap(StrokeLineCap.BUTT);

              StackPane stackPane = new StackPane();
              stackPane.setPrefSize(200,200);
              stackPane.getChildren().add(line);

              RadioButton butt = new RadioButton(StrokeLineCap.BUTT.name());
              butt.setOnAction(e -> line.setStrokeLineCap(StrokeLineCap.BUTT));
              RadioButton round = new RadioButton(StrokeLineCap.ROUND.name());
              round.setOnAction(e -> line.setStrokeLineCap(StrokeLineCap.ROUND));
              RadioButton square = new RadioButton(StrokeLineCap.SQUARE.name());
              square.setOnAction(e -> line.setStrokeLineCap(StrokeLineCap.SQUARE));

              ToggleGroup toggleGroup = new ToggleGroup();
              toggleGroup.getToggles().setAll(butt,round,square);
              toggleGroup.selectToggle(butt);

              VBox root = new VBox(5, stackPane, butt, round, square);
              root.setPadding(new Insets(10,10,10,10));
              primaryStage.setScene(new Scene(root,200,200));
              primaryStage.show();
          }

            kcr Kevin Rushforth
            dgrieve David Grieve
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: