Note that there are some explanatory texts on larger screens.

plurals
  1. USPSpeed
    primarykey
    data
    text
    plurals
    1. COIf it were me, I might look into how JSlider implements its own snap-to-tick functionality and see if that gives hints on a good way to do what you want. It's different but similar enough to maybe be inspiring.
      singulars
    2. COre: Your Edit 2, a custom ButtonModel should be able to handle that... Swing may already have one they use in their spinners but not exposed. Actually, looks like they do some complicated tricks in the action listener. I still think at first blush a custom button model would be easiest. Have setPressed(true) start a timer that fires action performed and setPressed(false) stop the timer. Add an initial delay to make it feel better.
      singulars
    3. COWhere did you do the snapping? The idea was to do it inside the custom bounded range model. The theory is that the JSlider will try to tell you 47 but the model wouldn't listen and just set its own value to 50... it would still need to fire a change event, though. That way the JSlider would know what the proper position for its thumb is. Since the user is still dragging, the mouse should still be in the '47' position and if they move a little more to the left then it should snap. If you describe what is actually happening then maybe I can think of something else.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload