![]() |
The Java Developers Almanac 1.4 |
|
e796. Setting the Orientation of a JSlider ComponentBesides 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);
e795. Getting and Setting the Values of a JSlider Component e797. Showing Tick Marks on a JSlider Component e798. Showing Tick-Mark Labels on a JSlider Component e799. Constraining JSlider Component Values to Tick Marks e800. Listening for Value Changes in a JSlider Component © 2002 Addison-Wesley. |