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

Right most Slider Axis label sometimes invisible.



    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      Java 8u20 ea b10, Windows and Linux


      When updating the max value, major tick unit, or simply resizing a slider sometimes its right most tick label disappears even though it should really be visible.

      This is especially noticeable if you set the major tick unit to be the same as the range of the slider so that you only have 2 tick labels.

      Possibly also contributing to this bug I have noticed that the first tick ("0" in the default constuctor) appears about 5 pixels in from the rounded point of the slider while the right most tick("100" in the default constructor) appears at the right tip of the slider. Perhaps this lack of symmetry is causing the axis to sometimes not have enough width to display the last label?

      Or this phenomenon can be contributed to rounding error. I noticed in Axis.layoutChildren() when positioning the tick.textNode it will make it invisible if it isn't <= the width of the axis ceiled...

      To reproduce:

      1. Run the provided test class. On my Windows system the slider will appear without its last "100" label showing.

      2. If you resize the window's width slowly either larger or smaller you will see the "100" label appear again.

      3. If the "100" tick label was visible when the Window showed simply resize the window's width slowly in both directions. You should be able to find a similar point where the label disappears but will show again when the window is made either bigger or smaller. On my Window's system this happens when the window is 164 pixels wide. On my Linux system the width has to be 153.

      ********************************************** Test Class ****************************************************
      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.scene.Scene;
      import javafx.scene.control.Slider;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class SliderTest extends Application {

         public void start(final Stage primaryStage) throws Exception {

            final Slider slider = new Slider();
            slider.setPadding(new Insets(12));
            primaryStage.setScene(new Scene( new StackPane( slider ) ));



         public static void main(String[] args) throws Exception {



          Issue Links



              msladecek Martin Sládeček
              csmithjfx Charles Smith (Inactive)
              0 Vote for this issue
              3 Start watching this issue