JProgressBar: setStringPainted(boolean b) : JProgressBar « javax.swing « Java by API






JProgressBar: setStringPainted(boolean b)

 
import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.border.Border;

public class MainClass {
  public static void main(String args[]) {
    JFrame f = new JFrame("JProgressBar Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JProgressBar progressBar = new JProgressBar();
    progressBar.setValue(25);
    progressBar.setStringPainted(true);
    Border border = BorderFactory.createTitledBorder("Reading...");
    progressBar.setBorder(border);
    f.add(progressBar, BorderLayout.NORTH);
    f.setSize(300, 100);
    f.setVisible(true);
  }
}

           
         
  








Related examples in the same category

1.JProgressBar.VERTICAL
2.new JProgressBar(int min, int max)
3.new JProgressBar(int orient, int min, int max)
4.JProgressBar: addChangeListener(ChangeListener l)
5.JProgressBar: getMaximum()
6.JProgressBar: getMinimum()
7.JProgressBar: getValue()
8.JProgressBar: setBorder(Border b)
9.JProgressBar: setBorderPainted(boolean b)
10.JProgressBar: setIndeterminate(boolean newValue)
11.JProgressBar: setMaximum(int n)
12.JProgressBar: setMinimum(int n)
13.JProgressBar: setValue(int v)