Practical 6
Practical 6
import javax.swing.*;
JFrame f;
Exp_6_2()
String country[]={"Maharashtra","Goa","Gujarat","Assam","Hyderabad","Delhi"};
cb.setBounds(50,50,120,20);
f.add(cb);
f.setLayout(null);
f.setSize(400,500);
f.setVisible(true); }
new select();
Output :
Q2. Develop a program to demonstrate the use of ScrollPane in Swings
import javax.swing.*;
frame.add(scrollPane);
frame.setSize(300, 300);
frame.setVisible(true);
Output :
Practical 7
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;
JFrameMain.setVisible(true);
JFrameMain.setSize(400,400);
rootNode.add(maharashtraNode);
rootNode.add(gujrathNode);
maharashtraNode.add(mumbaiSubNode);
maharashtraNode.add(puneSubNode);
maharashtraNode.add(nashikSubNode);
maharashtraNode.add(nagpurSubNode);
JFrameMain.add(tree);
}
}
Output :
Practical No . 8
import java.awt.*;
import javax.swing.*;
public table()
jf.add(jsp);
jf.setSize(550, 250);
jf.setTitle("Practical_8");
jf.setLayout(new FlowLayout());
jf.setVisible(true);
}
Output :
Practical No. 9
Q1.Develop a program to demonstrate the use of ProgressBar
import javax.swing.*;
JProgressBar jb;
int i=0,num=0;
ProgressBarExample(){
jb=new JProgressBar(0,2000);
jb.setBounds(40,40,160,30);
jb.setValue(0);
jb.setStringPainted(true);
add(jb);
setSize(250,150);
setLayout(null);
while(i<=2000){
jb.setValue(i);
i=i+20;
m.setVisible(true);
m.iterate();
}
Output :
Q2. Write a program using JProgressBar to show progress of Progress Bar when user clicks on JButton in Java
Programming
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
JProgressBar pb;
pbar() {
setLayout(null);
pb.setValue(0);
pb.setStringPainted(true);
pb.setVisible(false);
add(b1);
add(pb);
b1.addActionListener(this);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
int i = 0;
if (e.getSource() == b1) {
pb.setVisible(true);
try {
Thread.sleep(50);
pb.setValue(i);
i++;
m.setSize(330, 100);
m.setVisible(true);
Output :