0% found this document useful (0 votes)
1 views

Advanced Java Project 1 and 2

Uploaded by

sanskrutinile06
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)
1 views

Advanced Java Project 1 and 2

Uploaded by

sanskrutinile06
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/ 6

Pratical 1

Q.Demonstrate use of radiobutton and check box.


import java.awt.*;
import java.applet.*;
public class CheckRadio extends Frame
{
CheckRadio()
{

CheckboxGroup rb = new CheckboxGroup();

Checkbox cb = new Checkbox("java",rb,false);


cb.setBounds(80,80,60,50);
add(cb);

Checkbox cb1 = new Checkbox("Python",rb,false);


cb1.setBounds(80,120,60,50);
add(cb1);

Label l1 = new Label("Check Box start here!");


add(l1);
l1.setBounds(80,160,60,50);

Checkbox cb2 = new Checkbox("C++");


cb2.setBounds(80,200,60,50);
add(cb2);

Checkbox cb3 = new Checkbox("Java");


cb3.setBounds(80,240,60,50);
add(cb3);

setSize(400,400);
setTitle("Pankaj");
setLayout(null);
setVisible(true);
}
public static void main(String args[])
{
CheckRadio cr = new CheckRadio();
}
}
Q. to create form using Textfield, Textarea, Button, Label

import java.awt.*;
import java.applet.*;
public class Demo extends Frame
{
Demo()
{
Button b1 = new Button("Submit");
add(b1);
b1.setBounds(80,240,60,50);

Label l1 = new Label("Welcome to form",Label.RIGHT);


add(l1);
l1.setBounds(100,80,100,50);

TextField t1 = new TextField("Enter your Name");


add(t1);
t1.setBounds(80,180,120,50);

TextArea ta = new TextArea("Welcome Java",2,3);


add(ta);
ta.setBounds(80,300,120,50);

setSize(200,200);
setLayout(null);
setVisible(true);
setTitle("Pankaj");
}
public static void main(String args[])
{
Demo d = new Demo();
}
}
Q.Program using label to display “welcome to java”.

import java.awt.*;
import java.applet.*;
public class label extends Frame
{
label()
{
Label l1 = new Label("Welcome to Java");
add(l1);
l1.setBounds(100,80,150,60);

setSize(200,200);
setVisible(true);
setLayout(null);
setTitle("Pankaj");
}
public static void main(String args[])
{
label l2 = new label();
}}

Q. Program to create a three Buttons.


import java.awt.*;
import java.applet.*;
public class button extends Frame
{
button()
{
Button b1 = new Button("OK");
add(b1);
b1.setBounds(80,80,60,50);

Button b2 = new Button("RESET");


add(b2);
b2.setBounds(80,140,60,50);

Button b3 = new Button("CANCEL");


add(b3);
b3.setBounds(80,200,60,50);

setSize(200,200);
setLayout(null);
setVisible(true);
setTitle("Pankaj");
}
public static void main(String []args)
{
button bb = new button();
}}
Q.Program to select multiple languages.

import java.awt.*;
import java.applet.*;
public class Name extends Frame
{
Name()
{
Checkbox cb = new Checkbox("Marathi");
add(cb);
cb.setBounds(100,150,60,50);

Checkbox cb1 = new Checkbox("Sanskrit");


add(cb1);
cb1.setBounds(100,190,60,50);

Checkbox cb2 = new Checkbox("Hindi");


add(cb2);
cb2.setBounds(100,240,60,50);

Checkbox cb3 = new Checkbox("English");


add(cb3);
cb3.setBounds(100,280,60,50);

setSize(200,200);
setLayout(null);
setVisible(true);
setTitle("Pankaj");
}
public static void main(String []args)
{
Name n = new Name();
}
}
Pratical 2

Q. write java program to show following output.

import java.awt.*;
import java.applet.*;
public class list extends Frame
{
list()
{
List l1 = new List(3,false);
l1.add("Summer");
l1.add("Rainy");
l1.add("Winter");
add(l1);
l1.setBounds(100,120,150,60);

setSize(200,200);
setVisible(true);
setLayout(null);
setTitle("Pankaj");
}
public static void main(String args[])
{
list l2 = new list();
}
}

Q.Add name of 10 cities in list component.

import java.awt.*;
import java.applet.*;
public class list1 extends Frame
{
list1()
{
List l1 = new List(10,false);
l1.add("MUMBAI");
l1.add("THANE");
l1.add("KOLHAPUR");
l1.add("DHULE");
l1.add("NASHIK");
l1.add("CHHATRAPATI SAMBHAJI NAGAR");
l1.add("PUNE");
l1.add("RAIGAD");
l1.add("AHMEDNAGAR");
l1.add("NANDURBAR");
add(l1);
l1.setBounds(150,160,150,200);

setSize(200,200);
setVisible(true);
setLayout(null);
setTitle("Pankaj");
}
public static void main(String args[])
{
list1 li = new list1();
}
}

Q.select multiple news paper using list component.

import java.awt.*;
import java.applet.*;
public class list2 extends Frame
{
list2()
{
List l1 = new List();
l1.add("LOKMAT");
l1.add("KESARI");
l1.add("MAHARASHTRA TIMES");
l1.add("TIMES OF INDIA");
l1.add("DAINIK BHASKAR");
l1.add("HINDUSTAN");
l1.add("INDIAN EXPRESS");
l1.add("SAMNA");
add(l1);
l1.setBounds(100,120,190,100);

setSize(200,200);
setVisible(true);
setLayout(null);
setTitle("Pankaj");
}
public static void main(String args[])
{
list2 l2 = new list2();
}
}

You might also like