Example usage for javax.swing JProgressBar JProgressBar

List of usage examples for javax.swing JProgressBar JProgressBar

Introduction

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

Prototype

public JProgressBar(int min, int max) 

Source Link

Document

Creates a horizontal progress bar with the specified minimum and maximum.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);

    // Overlay a string showing the percentage done
    progress.setStringPainted(true);// w w  w  .  ja va2  s  .  c o m

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    int newValue = 10;
    int newMin = 0;
    int newMax = 100;
    progress.getModel().setRangeProperties(newValue, 0, newMin, newMax, false);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    // Get the current value
    int value = progress.getValue();

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

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

    // Change the minimum value
    int newMin = 0;
    progress.setMinimum(newMin);//from ww w. j  ava2s .  com

    // Change the maximum value
    int newMax = 256;
    progress.setMaximum(newMax);

    // Set the value; the new value will be forced into the bar's range
    int newValue = 33;
    progress.setValue(newValue);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    progress.setOrientation(SwingConstants.HORIZONTAL);
    int newValue = 33;
    progress.setValue(newValue);//ww w . jav  a  2s  .co  m

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal progress bar
    int min = 0;/* www. j a  va  2s.c om*/
    int max = 100;
    JProgressBar progress = new JProgressBar(min, max);

    // Play animation
    progress.setIndeterminate(true);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    progress.setOrientation(SwingConstants.HORIZONTAL);
    int newValue = 33;
    progress.setValue(newValue);//from  ww w.  j  a  va  2 s. co  m
    progress.setString("value");
    System.out.println(progress.getString());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    progress.setOrientation(SwingConstants.HORIZONTAL);
    int newValue = 33;
    progress.setValue(newValue);/*from w w w  .  j av a 2s. c o m*/

    System.out.println(progress.isStringPainted());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a horizontal progress bar
    int min = 0;/* ww w.  j a v a2s .  co  m*/
    int max = 100;
    JProgressBar progress = new JProgressBar(min, max);
    int value = 33;

    progress.setValue(value);
    progress.setIndeterminate(false);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);

    progress.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent evt) {
            JProgressBar comp = (JProgressBar) evt.getSource();
            int value = comp.getValue();
            int min = comp.getMinimum();
            int max = comp.getMaximum();
        }/*from w ww  .  j  a v a2s .  c  o  m*/
    });
}