Example usage for javax.swing DefaultBoundedRangeModel setMaximum

List of usage examples for javax.swing DefaultBoundedRangeModel setMaximum

Introduction

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

Prototype

public void setMaximum(int n) 

Source Link

Document

Sets the maximum to n after ensuring that n that the other three properties obey the model's constraints:
 minimum <= value <= value+extent <= maximum 

Usage

From source file:Main.java

public static void main(String args[]) {
    try {/* w  ww  . j  a va  2 s  . c o  m*/
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String args[]) {
    try {//  www.j  a  v a  2s  . c o m
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println(model.getMinimum());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String args[]) {
    try {//from  w  w  w .  jav a2  s  .  co  m
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println(model.getMaximum());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String args[]) {
    try {/*from   w w w  .  ja  v a 2s.  c  o  m*/
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println(model.getExtent());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String args[]) {
    try {/*from ww  w .j  a  v  a  2  s .c  o m*/
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println(model.getValue());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Bounded.java

public Bounded() {
    try {/* ww  w.j av  a2s.  c o  m*/
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}