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

Using an effect and a border causes the effect to render on top of the border

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: openjfx11
    • Fix Version/s: None
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Running on OpenJFX 11 using AdoptOpenJDK 11 (OpenJ9). I've tried both JFX 13 and JDK 13 with no luck.

      A DESCRIPTION OF THE PROBLEM :
      When you create a region, then apply a border (say a black, solid border with 1px width), THEN apply an effect (for my example an inner shadow), the effect will draw on top of the border, and there is no way to separate the two.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      First, create a region (my issue was caused by a button). Then, give this region a border (I used solid, black 1px). Then, give this region an effect (I used an innershadow). Your border is now completely overlayed by the effect

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The border to be drawn outside of the innershadow, considering it's an innershadow. Similarly, with a dropshadow, I'd expect the border to be drawn inside the dropshadow.
      ACTUAL -
      The border is drawn on top of the innershadow/dropshadow

      ---------- BEGIN SOURCE ----------
      public class App extends Application {
       
          @Override
          public void start(Stage primaryStage) throws Exception {
              Region example = new Region();
              example.setMaxWidth(100);
              example.setMaxHeight(100);
              example.setEffect(new InnerShadow(BlurType.GAUSSIAN, Color.RED, 10, 0.04, 0, 0));
              example.setStyle("-fx-background-color: white; -fx-border-color: BLUE; -fx-border-width: 5px;");
       
              StackPane container = new StackPane();
              container.setStyle("-fx-background-color: black;");
              container.setAlignment(Pos.CENTER);
              container.getChildren().add(example);
       
              Scene scene = new Scene(container, 400, 400);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
       
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      If you surround the region in a generic "pane", you can set the border of the pane and set the effect to the region. However I have found poor scaling with this as there is almost always a pixel gap between the parent and the child.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: