0% found this document useful (0 votes)
73 views4 pages

Pra 9

The document provides code examples for using JProgressBar in Java programs. It includes code to: 1. Generate a progress bar that increments from 0 to 2000 over 2 seconds in 100ms intervals. 2. Demonstrate a basic progress bar without any updating functionality. 3. Show a progress bar that is launched when the user clicks a JButton, though the code does not include functionality for updating the progress bar.

Uploaded by

nstrnsdtn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views4 pages

Pra 9

The document provides code examples for using JProgressBar in Java programs. It includes code to: 1. Generate a progress bar that increments from 0 to 2000 over 2 seconds in 100ms intervals. 2. Demonstrate a basic progress bar without any updating functionality. 3. Show a progress bar that is launched when the user clicks a JButton, though the code does not include functionality for updating the progress bar.

Uploaded by

nstrnsdtn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ADVANCE JAVA PROGRAMMING

Name :- Ayush Maroti Wadje Class : - CO5I

Roll No :- 76

Practical No 9 :- Write a Program To Launch a ProgressBar.

X. ------------- ?

1. Write a Program Code To Generate The Following Output.

Code :-

import javax.swing.*;

public class JProgressBarEx extends JFrame{


JProgressBar JB;
int i =0,num=0;
JProgressBarEx() {
JB = new JProgressBar(0, 2000);
JB.setBounds(40, 40, 160, 30);
JB.setValue(0);
JB.setStringPainted(true);
setSize(300, 200);
setLayout(null);
add(JB);
}
public void iterate(){
while(i<=2000){
JB.setValue(i);
i =i+20;
try{
Thread.sleep(100);
}
catch (Exception E)
{
}
}
}
public static void main(String[] args)
{
JProgressBarEx B=new JProgressBarEx();
B.setVisible(true);
B. iterate();
}
}
Output :-
XIII. Exercise.

1. Develop a Program To Demonstrate The Use Of JProgressBar.

Code :-

import java.awt.*;
import javax.swing.*;
public class JProgressBarEx2 extends JFrame {
JProgressBarEx2() {
setLayout(new Flowlayout());
setSize(200,200);
setVisible(true);
JProgressBar JPD=new JProgressBar();
add(JPD);
}
public static void main(String args[]) {
JProgressBarEx2 jb=new JProgressBarEx2();
}
}
Output :-
2.Write a Program Using JProgressBar To Show The ProgressBar When User
Clicks On JButton.

Code :-

Output :-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy