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

Slider: invalid behavior of snapToTicks when the slider range and the tick unit value are nonagreed.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 9
    • javafx

    Description

      JDK9 b132 + Win. 7

      Please run the following test code:

      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.Slider;
      import javafx.stage.Stage;

      public class SliderTest extends Application {

          @Override
          public void start(Stage stage) {

              Group root = new Group();
              Scene scene = new Scene(root, 150, 100);
              stage.setScene(scene);

              double x = 0.05;
              Slider s = new Slider(x / 10, x, x / 3);
              s.setShowTickLabels(true);
              s.setShowTickMarks(true);
              s.setMajorTickUnit(x / 3);
              s.setMinorTickCount(1);
              s.setSnapToTicks(true);

              root.getChildren().add(s);
              stage.show();
          }

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

      please note that the range length is not multiple of the tick unit. the effects:
      1. when shown, the slider position isn't snapped to any tick
      2. the user cannot set the slider to the max position (0.05), it resiles to the previous tick

      please note also that the distances between the ticks are not equal (but this point is probably expected).

      the case is doubtful, but nevertheless it seems the slider should behave properly even in this situation.

      Attachments

        Activity

          People

            Unassigned Unassigned
            avstepan Alexander Stepanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: