Example usage for javax.swing BoundedRangeModel setRangeProperties

List of usage examples for javax.swing BoundedRangeModel setRangeProperties

Introduction

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

Prototype

void setRangeProperties(int value, int extent, int min, int max, boolean adjusting);

Source Link

Document

This method sets all of the model's data with a single method call.

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);
    model.setRangeProperties(10, 10, 0, 20, true);

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

    frame.setSize(300, 200);/*  w w  w  .j ava2 s .co  m*/
    frame.setVisible(true);
}