1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import javax.swing.SwingUtilities;
/**
*
* @author abdellatif
*/
public class ProgBar extends javax.swing.JFrame {
protected int minValue = 0;
protected int maxValue;
protected int counter = 0;
protected int debut=0;
String line=" line successfully ";
/** Creates new form ProgBar */
public ProgBar() {
initComponents();
this.setTitle("Progressing...");
this.setLocationRelativeTo(null);
}
public void Progbar()
{
Thread runner = new Thread()
{
@Override
public void run()
{
Runnable runme = new Runnable()
{
@Override
public void run()
{
jProgressBar1.setValue(counter);
jTextArea1.append(String.valueOf(counter));
jTextArea1.append(line+"\n");
}
};
SwingUtilities.invokeLater(runme);
minValue=counter++;
try {
Thread.sleep(100);
} catch (Exception ex) {}
}
};
runner.start();
} |
Partager