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

Wrong implementation of adjustValue in scrollBars




      Run this sample program :

      import javafx.application.Application;
      import static javafx.application.Application.launch;
      import javafx.geometry.Side;
      import javafx.scene.Scene;
      import javafx.scene.control.MenuButton;
      import javafx.scene.control.MenuItem;
      import javafx.scene.control.ScrollPane;
      import javafx.stage.Stage;

      public class TestMenuButton extends Application {

          public static void main(String[] args) {

          public void start(Stage primaryStage) throws Exception {
              MenuButton button = new MenuButton("button");
              MenuItem item = new MenuItem("this is a test");
              button.setMinSize(500, 500);
              ScrollPane pane = new ScrollPane(button);
              Scene scene = new Scene(pane);

      Make the window large enough to have scrollBars visible and thumbs big enough.

      Now if you click on the track, the thumb will move into that direction. If your thumb is very small and your click point is very far, you will only move by a blockIncrement which is very logic.

      Now if you are close to one end but totally, the behavior is very odd. Clicking between the end and your thumb will not move the thumb entirely to the end but bring the thumb to the clickPoint!

      I don't think this is a normal behavior, I've taken all my applications (browser, windows explorer etc) and all of them are moving by block increment at the end.

      The two lines responsible for that are situated in the ScrollBar code, in adjustValue :
      if (incrementing && newValue > posValue) newValue = posValue;
                  if (! incrementing && newValue < posValue) newValue = posValue;

      This is very annoying and could not be changed in the TableView for example because the scrollbars are constructed within the VirtualFlow and could not be overriden.


        Issue Links



              shadzic Samir Hadzic
              shadzic Samir Hadzic
              0 Vote for this issue
              4 Start watching this issue