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

ScrollPane introduces distortions when scrolling up & down

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u60
    • 8u20
    • javafx
    • Win 8.1, Intel i7, Eclipse Luna, Java 8u25 or 8u40

      With ScrollPane content composed of Labels (text only) within HBox-es within a VBox, all with borders, scrolling up& down (even slowly) introduces distortions (borders get "lost");
      I do not recall seeing this issue in earlier Java 8 versions.
      The following code exhibits the behavior on my system:

      import javafx.application.Application;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class TestSP extends Application {
      ;
      private final String STYLE = ""
      +"-fx-alignment: center;"
      +"-fx-border-color: black;"
      +"-fx-border-width: 2;"
      +"-fx-border-radius: 8;"
      +"-fx-padding: 3;"
      +"-fx-text-wrap: true;"
      ;


      VBox root = new VBox();
      Scene scene = new Scene(root);
          
      public static void main(String[] args) {
              launch(args);
          }
          @Override
          public void start(Stage primaryStage) {
                primaryStage.setWidth(800);
              primaryStage.setHeight(600);
              
              primaryStage.setScene(scene);
              primaryStage.show();
              root.getChildren().add(createPanel());
          }
         
          int ind=0;
            
          private Node createBlock() {
           HBox blk = new HBox(5);
           blk.setStyle(STYLE);
           for (int i=0;i<6;i++) {
           Label l= new Label("This is label #"+ind++);
               l.setStyle(STYLE);
           blk.getChildren().add(l);
           }
           return blk;
          }
          
          
          private ScrollPane createPanel() {
           ScrollPane sp = new ScrollPane();
              VBox.setVgrow(sp, Priority.ALWAYS);
           VBox vb = new VBox(10);
           sp.setContent(vb);
           for (int i=0;i<20;i++)
           vb.getChildren().add(createBlock());
           sp.setStyle(STYLE);
           return sp;
          }

      }

            ckyang Chien Yang (Inactive)
            yorenjfx Yair Oren (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: