ProgressBar Demo : ProgressBar « Swing JFC « Java






ProgressBar Demo

ProgressBar Demo
  
import java.awt.BorderLayout;
import java.awt.Container;

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

public class AProgressBar {
  public static void main(String args[]) {
    JProgressBar aJProgressBar = new JProgressBar();
    aJProgressBar.setValue(50);
    JProgressBar bJProgressBar = new JProgressBar();
    bJProgressBar.setValue(25);
    bJProgressBar.setStringPainted(true);
    Border border = BorderFactory.createTitledBorder("Reading File");
    bJProgressBar.setBorder(border);
    JProgressBar cJProgressBar = new JProgressBar(JProgressBar.VERTICAL);
    cJProgressBar.setValue(75);
    cJProgressBar.setBorderPainted(false);

    JProgressBar dJProgressBar = new JProgressBar(JProgressBar.VERTICAL);
    dJProgressBar.setValue(100);
    dJProgressBar.setString("Ack");
    dJProgressBar.setStringPainted(true);

    JFrame theFrame = new JFrame("ProgressBars R Us");
    theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container contentPane = theFrame.getContentPane();
    contentPane.add(aJProgressBar, BorderLayout.NORTH);
    contentPane.add(bJProgressBar, BorderLayout.SOUTH);
    contentPane.add(cJProgressBar, BorderLayout.EAST);
    contentPane.add(dJProgressBar, BorderLayout.WEST);
    theFrame.setSize(300, 200);
    theFrame.setVisible(true);
  }
}

           
         
    
  








Related examples in the same category

1.Create a ProgressBar
2.Create a horizontal progress bar
3.Create a vertical progress bar
4.Creating a JProgressBar Component with an Unknown Maximum
5.Set all the values at once by using the model
6.Listening for Value Changes in a JProgressBar Component
7.Displaying the Percentage Done on a JProgressBar Component
8.Getting and Setting the Values of a JProgressBar Component
9.ProgressBar Demo: long taskProgressBar Demo: long task
10.When information on the task's progress is available, the progress bar can be made determinate:
11.Implement a progressbar in your application
12.ProgressMonitor DemoProgressMonitor Demo
13.Creating a modal progress dialog
14.ProgressBar Demo 2ProgressBar Demo 2
15.Use an actual input file to monitor rather than inducing progress manually
16.A demonstration of the ProgressMonitor toolbarA demonstration of the ProgressMonitor toolbar
17.A demonstration of the JProgressBar componentA demonstration of the JProgressBar component
18.Progress bar SampleProgress bar Sample
19.Sample ProgressSample Progress
20.ProgressBar StepProgressBar Step
21.Progressbar demo: set selection background, selection foreground and foregroundProgressbar demo: set selection background, selection foreground and foreground
22.This program demonstrates the use of a progress bar to monitor the progress of a thread.This program demonstrates the use of a progress bar to monitor the progress of a thread.