Make ProgressBar with Java Swing
Creating ProgressBar using Java Swing:https://youtu.be/w6tHLiH_i6k ________________________________________________ How to make ProgressBar?
package Test;
import javax.swing.*;
public class ProgressBar {
int i=0, num=0;
JFrame frame;
JProgressBar jb;
ProgressBar(){
frame = new JFrame("ProgressBar Example");
frame.setBounds(550,200,250,150);
frame.setLayout(null);
frame.setVisible(true);
jb = new JProgressBar(0,2000);
jb.setBounds(40,40,160,30);
jb.setValue(0);
jb.setStringPainted(true);
frame.add(jb);
}
public void iterate() {
while(i<=2000) {
jb.setValue(i);
i=i+20;
try {Thread.sleep(150);}catch(Exception e) {}
}
}
public static void main(String[] args) {
ProgressBar bar = new ProgressBar();
bar.iterate();
}
}
Dark Hers
YouTube
https://instagram.com/darkhers
https://www.facebook.com/darkhers
TikTok
https://www.tiktok.com/@darkhers
https://www.pinterest.co.uk/darkhers
Comments
Post a Comment