Virtical JProgressBar : JProgressBar « Swing « Java Tutorial

To change the label to a fixed string, call the public void setString(String newValue) method and setStringPainted(true). On a vertical progress bar, the string is drawn rotated, so a longer string will fit better.

Virtical JProgressBar
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

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

class BarThread extends Thread {
  private static int DELAY = 500;

  JProgressBar progressBar;

  public BarThread(JProgressBar bar) {
    progressBar = bar;

  public void run() {
    int minimum = progressBar.getMinimum();
    int maximum = progressBar.getMaximum();
    for (int i = minimum; i < maximum; i++) {
      try {
        int value = progressBar.getValue();
        progressBar.setValue(value + 1);

      } catch (InterruptedException ignoredException) {

public class ProgressBarStep {

  public static void main(String args[]) {
    JFrame frame = new JFrame("Stepping Progress");
    final JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL);

    final JButton aJButton = new JButton("Start");

    ActionListener actionListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Thread stepper = new BarThread(aJProgressBar);
    frame.add(aJProgressBar, BorderLayout.NORTH);
    frame.add(aJButton, BorderLayout.SOUTH);
    frame.setSize(300, 200);

14.32.2.Creating a JProgressBar Component with an Unknown Maximum
14.32.3.A progress bar is used for lengthy tasks.
14.32.4.Labeling a JProgressBarLabeling a JProgressBar
14.32.5.Virtical JProgressBarVirtical JProgressBar
14.32.6.Creating a modal progress dialog
14.32.7.Set all the values at once by using the model
14.32.8.Using an Indeterminate JProgressBarUsing an Indeterminate JProgressBar
14.32.9.Displaying the Percentage Done on a JProgressBar Component
14.32.10.Getting and Setting the Values of a JProgressBar Component
14.32.11.Listening for Value Changes in a JProgressBar Component
14.32.12.Handling JProgressBar Events: notification of data model changes through a ChangeListenerHandling JProgressBar Events: notification of data model changes through a ChangeListener
14.32.13.ProgressBar and Task
14.32.14.SwingWorker and ProgressBar
14.32.15.Customizing JProgressBar Look and Feel