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

ScrollPane bottom right corner has a one pixel edge of background color when both scrollbars are visible

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • emb-8u6, 8u20
    • 8
    • javafx
    • Windows 7 64-bit
      Java 8.0 b120

      Depends on what container you put the ScrollPane in. Flip the boolean in the code below to see different issues.

      package scrollpanetrails;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class ScrollPaneTrails extends Application {
          
          @Override
          public void start(Stage primaryStage) {
              VBox vbox = new VBox(4);
              vbox.setStyle("-fx-background-color: green");
              ScrollPane sp = new ScrollPane(vbox);
              sp.setStyle("-fx-background-color: purple;");
              for(int i = 0; i < 20; i++) {
                  vbox.getChildren().add(new Label("Scroll slowly and look carefully at the quality of the revealed text "+i));
              }

              BorderPane root = new BorderPane();
      MenuBar menus = new MenuBar();
      root.setTop(menus);
      menus.getMenus().add(new Menu("File"));

      // CHANGE THIS TO FALSE to see a different problem
      // Expand the window horizontally so that the green vbox has some extra
      // space to the right.. now there is nan extra bit of ScrollPane
      // background showing at the bottom of the viewport. It is copied into
      // the viewport when you scroll
              if (true) {
                  Tab tab = new Tab("My Tab");
                  tab.setContent(sp);
                  TabPane tabs = new TabPane();
                  tabs.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
                  tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
                  tabs.getTabs().add(tab);
                  root.setCenter(tabs);
              } else {
                  root.setCenter(sp);
              }
              Scene scene = new Scene(root, 300, 250);
              primaryStage.setTitle("Scrolling Artifacts!");
              primaryStage.setScene(scene);
              primaryStage.show();

          }

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

            jgiles Jonathan Giles
            swpalmer Scott Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: