[Original] A progress bar of a read file
. / ** * @ (#) TestProgressBar.java * * Copyright 2004 Opensource Develop Team All rights reserved * /// packagepackage com.opensource.progressbar;. // import classesimport java.awt.FlowLayout; import java.awt.event .ActionEvent; import java.awt.event.ActionListener; import java.io.FileInputStream; import java.io.InputStream; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.ProgressMonitorInputStream; / ** * When reading a big file, you need to display a progress bar prompting that users have to read and have * read how much content. * @Author @ @Author odt * @version 1.0 01/05/2004 * @since jdk 1.3 * / public class testprogressbar {public static void main (string [] args) {// Create a button Final JFrame f = new jframe ("Sample"); F.GetContentPane (). SetLayout (New flowLayout ()); jbutton b = new jbutton ("press me"); f.getContentPane (). Add (b); f.pack (); / / set up the file read Action B.AddActionListener (New ActionListener () {Public Void ActionPerformed (ActionEvent E) {// Start a thread to read files when Button presses.