Besides being either horizontal or vertical, a slider can also be inverted. An inverted horizontal slider moves from right-to-left. An inverted vertical slider moves from top-to-bottom.
// Create a horizontal slider that moves left-to-right
JSlider slider = new JSlider(); // Make the horizontal slider move right-to-left
slider.setInverted(true); // Make it vertical and move bottom-to-top
slider.setOrientation(JSlider.VERTICAL);
slider.setInverted(false); // Make it vertical and move top-to-bottom
slider.setOrientation(JSlider.VERTICAL);
slider.setInverted(true);
Related Examples |