//******************** (Practical 6) X1 ************************
import [Link].*;
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame implements ItemListener
{
JLabel l=new JLabel("Where are you");
public Practical1()
{
setLayout(new FlowLayout());
JComboBox jcb = new JComboBox();
[Link](this);
[Link]("pune");
[Link]("solapur");
[Link]("Bengluru");
[Link]("mumbai");
add(jcb);
add(l);
[Link](300,300);
[Link](true);
}
public void itemStateChanged(ItemEvent ie)
{
String s = (String)[Link]();
[Link]("you are in "+s);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 6) XIII1 ************************
import [Link].*;
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame implements ItemListener
{
JLabel l=new JLabel("Where are you");
public Practical1()
{
setLayout(new FlowLayout());
JComboBox jcb = new JComboBox();
[Link](this);
[Link]("Maharashtra");
[Link]("Gujrat");
[Link]("Kerala");
[Link]("Karnataka");
[Link]("Goa");
[Link]("Rajsthan");
add(jcb);
add(l);
[Link](300,300);
[Link](true);
}
public void itemStateChanged(ItemEvent ie)
{
String s = (String)[Link]();
[Link](""+s);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 6) XIII2 ************************
import [Link].*;
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame
{
public Practical1()
{
setLayout(new FlowLayout());
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
JTextArea jta = new JTextArea(20,20);
JScrollPane jsp = new JScrollPane(jta,v,h);
add(jsp);
[Link](300,300);
[Link](true);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 7) X 1,2 ************************
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame
{
public Practical1()
{
setLayout(new FlowLayout());
DefaultMutableTreeNode country = new
DefaultMutableTreeNode("India",true);
DefaultMutableTreeNode s1 = new
DefaultMutableTreeNode("Maharashtra",true);
[Link](new DefaultMutableTreeNode("Mumbai"));
[Link](new DefaultMutableTreeNode("Nashik"));
[Link](new DefaultMutableTreeNode("Pune"));
[Link](new DefaultMutableTreeNode("Nagpur"));
[Link](s1);
DefaultMutableTreeNode s2 = new
DefaultMutableTreeNode("Gujrat",true);
[Link](new DefaultMutableTreeNode("Ahamdabad"));
[Link](new DefaultMutableTreeNode("Gandhinagar"));
[Link](s1);
[Link](s2);
JTree jt = new JTree(country);
[Link](jt);
[Link](300,300);
[Link](true);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 7) XIII ************************
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame
{
public Practical1()
{
setLayout(new FlowLayout());
DefaultMutableTreeNode drive = new
DefaultMutableTreeNode("DRIVE",true);
DefaultMutableTreeNode s1 = new
DefaultMutableTreeNode("FOLDER 1",true);
[Link](new DefaultMutableTreeNode("FILE 1"));
[Link](new DefaultMutableTreeNode("FILE 2"));
[Link](new DefaultMutableTreeNode("FILE 3"));
[Link](new DefaultMutableTreeNode("FILE 4"));
[Link](s1);
DefaultMutableTreeNode s2 = new
DefaultMutableTreeNode("FOLDER 2",true);
[Link](new DefaultMutableTreeNode("FILE 1"));
[Link](new DefaultMutableTreeNode("FILE 2"));
[Link](s1);
[Link](s2);
JTree jt = new JTree(drive);
[Link](jt);
[Link](300,300);
[Link](true);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 8) X 1,2 ************************
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame
{
public Practical1()
{
setLayout(new FlowLayout());
final String[] th = {"ID","NAME","SALARY"};
final Object[][] table = {
{101,"Amit",670000},
{102,"Jai",700000},
{101,"Sachin",70000}};
JTable jt = new JTable(table,th);
JScrollPane jsp = new JScrollPane(jt,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,[Link]
RIZONTAL_SCROLLBAR_ALWAYS);
add(jsp);
[Link](300,300);
[Link](true);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 8) XIII 1 ************************
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame
{
public Practical1()
{
setLayout(new FlowLayout());
final String[] th = {"NAME","PERCENTAGE","GRADE"};
final Object[][] table = {
{"student 1",95.67,"A+"},
{"student 2",80,"A+"},
{"student 3",60,"A"},
{"student 4",89,"A+"},
{"student 5",78,"A+"},
{"student 6",49,"B+"},
{"student 7",89,"A+"},
{"student 8",89,"A+"},
{"student 9",78,"A+"},
{"student 10",78,"A+"}};
JTable jt = new JTable(table,th);
JScrollPane jsp = new JScrollPane(jt,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,[Link]
RIZONTAL_SCROLLBAR_ALWAYS);
add(jsp);
[Link](300,300);
[Link](true);
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 9) X 1 ************************
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame
{
JProgressBar jpb = new JProgressBar(0,100);
public Practical1()
{
setLayout(new FlowLayout());
[Link](true);
[Link](0);
add(jpb);
[Link](300,300);
[Link](true);
progress();
}
public void progress()
{
int i = 1;
try {
while (i <= 500) {
[Link](1000);
[Link](i);
i++;
}
}
catch(Exception e)
{
}
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :
//******************** (Practical 9) XIII 1,2
************************
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
public class Practical1 extends JFrame implements ActionListener
{
JProgressBar jpb = new JProgressBar(0,100);
Button b = new Button("Progress");
public Practical1()
{
setLayout(new FlowLayout());
[Link](true);
add(jpb);
add(b);
[Link](this);
[Link](300,300);
[Link](true);
}
public void actionPerformed(ActionEvent ae) {
int i = 1;
try {
while (i <= 100) {
[Link](10);
[Link](i);
i++;
}
} catch (Exception e) {
}
public static void main(String a[])
{
Practical1 p = new Practical1();
}
}
//OUTPUT :