ProgressBar

No Comment - Post a comment

/* Simple Java Program for the implementation of ProgressBar, you can also refer to the progressbar code given beow and implement it in your programs */

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class ProgressBarr extends JFrame implements ActionListener
{
JButton jb;
JProgressBar jpb1;
int value =0;
ProgressBarr()
{
Container contentPane=getContentPane();
contentPane.setLayout(new FlowLayout());

jb = new JButton("Click");
contentPane.add(jb);
jb.addActionListener(this);

jpb1 = new JProgressBar(0,1000);
contentPane.add(jpb1);
jpb1.setStringPainted(true);
}

public static void main(String args[])
{
ProgressBarr pb1 = new ProgressBarr();
pb1.setSize(500,500);
pb1.setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
while(value< =1000)
{
value = value+10;
jpb1.setValue(value);
}
}
}

 
This Post has No Comment Add your own!

Post a Comment