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

Region's background drawing bad

XMLWordPrintable

      I added two background fills to a region, both using color paint, only the second with an inset. the final result is wrong, the second fill looks like a gradient (see picture)

      Here is the code:
      public class HelloRegion extends Application {
          public static void main(String[] args) {
      // System.setProperty("prism.order", "sw");
      // System.setProperty("prism.order", "j2d");
              Application.launch(args);
          }
          
          @Override
          public void start(Stage stage) throws Exception {
              Region region = new Region();
              
              region.setLayoutX(10);
              region.setLayoutY(10);
              region.setPrefWidth(100);
              region.setPrefHeight(100);
              
              BackgroundFill b1 = new BackgroundFill(Color.RED, null, null);
              BackgroundFill b2 = new BackgroundFill(Color.BLUE, new CornerRadii(30), null);
              BackgroundFill b3 = new BackgroundFill(Color.YELLOW, null, new Insets(40));
      // region.setBackground(new Background(b1, b2, b3));
            region.setBackground(new Background(b1, b3));
              
              Group group = new Group();
              group.getChildren().add(region);
              Scene scene = new Scene(group, 300, 300/*, Color.VIOLET*/);
              stage.setTitle(getClass().getCanonicalName());
              
              stage.setScene(scene);
              stage.show();
          }

      }

            rbair Richard Bair (Inactive)
            fheidric Felipe Heidrich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: