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

Region is not properly clipped when defined by a shape

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u40
    • 8u20
    • javafx
    • Windows 7 64-bit
      Java 8u20 b23
      (and earlier release versions of both Java 7 and 8)

      A Region defined by -fx-shape is leaving trails on the screen when a reposition it.

      Could be related to RT-25066, RT-33502

      Here is a simple test case:

      cliptest/ClipTest.css:

      .custom-arrow {
      -fx-position-shape: false;
      -fx-scale-shape: false;
      -fx-shape: "M0,0L8,3L8-3z";
      -fx-border-color: white;
      -fx-border-width: 2;
      -fx-background-color: white;
      }


      cliptest/ClipTest.java:

      package cliptest;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.AnchorPane;
      import javafx.scene.layout.Region;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;

      public class ClipTest extends Application {

      @Override
      public void start(Stage primaryStage) {
      Region arrow = new Region();
      arrow.getStyleClass().add("custom-arrow");
      arrow.setOnMouseDragged(evt -> {
      AnchorPane.setLeftAnchor(arrow, evt.getSceneX());
      AnchorPane.setTopAnchor(arrow, evt.getSceneY());
      });

      AnchorPane root = new AnchorPane();
      root.getChildren().add(arrow);
      AnchorPane.setLeftAnchor(arrow, 100.0);
      AnchorPane.setTopAnchor(arrow, 100.0);

      Scene scene = new Scene(root, 500, 400);
      scene.setFill(Color.BLACK);
      scene.getStylesheets().add("/cliptest/ClipTest.css");

      primaryStage.setTitle("Region clipping issue - Drag the triangle");
      primaryStage.setScene(scene);
      primaryStage.show();
      }

      public static void main(String[] args) { launch(args); }
      }

            msladecek Martin Sládeček
            swpalmer Scott Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: