Example usage for javax.swing BoundedRangeModel getValueIsAdjusting

List of usage examples for javax.swing BoundedRangeModel getValueIsAdjusting

Introduction

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

Prototype

boolean getValueIsAdjusting();

Source Link

Document

Returns true if the current changes to the value property are part of a series of changes.

Usage

From source file:Main.java

public static void main(String args[]) throws Exception {
    ChangeListener changeListener = new BoundedChangeListener();
    JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    BoundedRangeModel model = anotherJScrollBar.getModel();
    model.addChangeListener(changeListener);
    System.out.println(model.getValueIsAdjusting());

    JFrame frame = new JFrame("ScrollBars R Us");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(anotherJScrollBar, BorderLayout.NORTH);

    frame.setSize(300, 200);/* www. j a v  a2s . c o m*/
    frame.setVisible(true);
}

From source file:BoundedChangeListener.java

public void stateChanged(ChangeEvent changeEvent) {
    Object source = changeEvent.getSource();
    if (source instanceof BoundedRangeModel) {
        BoundedRangeModel aModel = (BoundedRangeModel) source;
        if (!aModel.getValueIsAdjusting()) {
            System.out.println("Changed: " + aModel.getValue());
        }//  w w  w  . j  a  va2s .  c o m
    } else {
        System.out.println("Something changed: " + source);
    }
}

From source file:BoundedChangeListener.java

public void stateChanged(ChangeEvent changeEvent) {
    Object source = changeEvent.getSource();
    if (source instanceof BoundedRangeModel) {
        BoundedRangeModel aModel = (BoundedRangeModel) source;
        if (!aModel.getValueIsAdjusting()) {
            System.out.println("Changed: " + aModel.getValue());
        }/*w w  w. java 2 s  . c om*/
    } else if (source instanceof JSlider) {
        JSlider theJSlider = (JSlider) source;
        if (!theJSlider.getValueIsAdjusting()) {
            System.out.println("Slider changed: " + theJSlider.getValue());
        }
    } else {
        System.out.println("Something changed: " + source);
    }
}

From source file:Main.java

public void stateChanged(ChangeEvent changeEvent) {
    Object source = changeEvent.getSource();
    if (source instanceof BoundedRangeModel) {
        BoundedRangeModel aModel = (BoundedRangeModel) source;
        if (!aModel.getValueIsAdjusting()) {
            System.out.println("Changed: " + aModel.getValue());
        }/*from w  w w.j  a  v a 2 s .  co m*/
    } else if (source instanceof JSlider) {
        JSlider theJSlider = (JSlider) source;
        if (!theJSlider.getValueIsAdjusting()) {
            System.out.println("Slider changed: " + theJSlider.getValue());
        }
    } else if (source instanceof JProgressBar) {
        JProgressBar theJProgressBar = (JProgressBar) source;
        System.out.println("ProgressBar changed: " + theJProgressBar.getValue());
    } else {
        System.out.println("Something changed: " + source);
    }
}