As explained in the title, i made a simple JSlider, and i successfully setted a minimum and maximum value, and a minor tick spacing, then i setted the "setSnapToTicks" to true. No problem with that part, my knob move on the closest tick when the user release the mouse, it can't be easier.
But now i want to get this effect without release the mouse, the knob have to move tick by tick without paying any attention on the values between those ticks, i want it to "jump" only on ticks values. I just made many searches, and i didn't find the answer, i just eard about "setExtent", which is supposed to set the sort of step i'm searching for, but it didn't work after some debugging. Here is my simple declaration of the JSlider :
sliderFlightLevel = new JSlider();
sliderFlightLevel.setValue(100);
sliderFlightLevel.setMinorTickSpacing(100);
sliderFlightLevel.setMinimum(100);
sliderFlightLevel.setMaximum(50000);
GridBagConstraints gbcSliderFlightLevel = new GridBagConstraints();
gbcSliderFlightLevel.gridwidth = 3;
gbcSliderFlightLevel.insets = new Insets(0, 10, 5, 10);
gbcSliderFlightLevel.fill = GridBagConstraints.HORIZONTAL;
gbcSliderFlightLevel.gridx = 0;
gbcSliderFlightLevel.gridy = 1;
mainPanel.add(sliderFlightLevel, gbcSliderFlightLevel);
Thanks for reading, i hope i'll get some help :)