Example usage for javax.swing JSlider JSlider

List of usage examples for javax.swing JSlider JSlider

Introduction

In this page you can find the example usage for javax.swing JSlider JSlider.

Prototype

public JSlider() 

Source Link

Document

Creates a horizontal slider with the range 0 to 100 and an initial value of 50.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JSlider slider = new JSlider();

    // Set an extent
    int extent = 10;
    slider.setExtent(extent);/*from   w  w  w .  ja  v  a2  s  . co m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JSlider slider = new JSlider();

    // Set major tick marks every 25 units
    int tickSpacing = 25;
    slider.setMajorTickSpacing(tickSpacing);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JSlider slider = new JSlider();

    int newMin = 0;
    slider.setMinimum(newMin);/* w  w w. j  a  v  a2s . c om*/

    int newMax = 256;
    slider.setMaximum(newMax);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JSlider slider = new JSlider();

    // Get the current value
    int value = slider.getValue();

    // Get the minimum value
    int min = slider.getMinimum();

    // Get the maximum value
    int max = slider.getMaximum();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal slider that moves left-to-right
    JSlider slider = new JSlider();

    slider.setSnapToTicks(true);// w  w w . j a v  a2 s.c  o  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal slider that moves left-to-right
    JSlider slider = new JSlider();

    boolean b = slider.getSnapToTicks(); // false
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal slider that moves left-to-right
    JSlider slider = new JSlider();
    // Determine if currently showing ticks
    boolean b = slider.getPaintTicks(); // false

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal slider that moves left-to-right
    JSlider slider = new JSlider();
    // Set major tick marks every 25 units
    int tickSpacing = 25;
    slider.setMajorTickSpacing(tickSpacing);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal slider that moves left-to-right
    JSlider slider = new JSlider();

    int tickSpacing = 5;
    slider.setMinorTickSpacing(tickSpacing);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal slider that moves left-to-right
    JSlider slider = new JSlider();

    slider.setPaintTicks(true);//  w w  w . j  av a 2 s .  c  om

}