Java JProgressBar .setIndeterminate (boolean newValue)

Syntax

JProgressBar.setIndeterminate(boolean newValue) has the following syntax.

public void setIndeterminate(boolean newValue)

Example

In the following code shows how to use JProgressBar.setIndeterminate(boolean newValue) method.


/*  ww w  . j  av a  2 s  .  c o  m*/
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JProgressBar;

public class Main {
  public static void main(String args[]) throws Exception {
    JFrame frame = new JFrame("Indeterminate");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JProgressBar aJProgressBar = new JProgressBar();
    aJProgressBar.setIndeterminate(true);
    frame.add(aJProgressBar, BorderLayout.NORTH);
    frame.setSize(300, 100);
    frame.setVisible(true);
  }

}