So I'm a bit nonplussed at the JSlider default key bindings for vertical sliders.
Is there a way to customize this behavior?
You can access the keybindings via the getInputMap
and getActionMap
methods.
For example, to switch the home/end key bindings (make Home go to the top, and end go to the bottom):
InputMap im = yourSlider.getInputMap();
im.put(KeyStroke.getKeyStroke("HOME"), "maxScroll");
im.put(KeyStroke.getKeyStroke("END"), "minScroll");
Here's a tutorial on key bindings.