Practical 1
Practical 1
import java.awt.*;
import java.applet.*;
public class LabelDemo extends Applet {
public void init() {
Label one = new Label("Welcome to java Programming",Label.RIGHT);
Label two = new Label("Welcome to java Programming",Label.LEFT);
// Demonstrate Buttons
import java.awt.*;
import java.applet.*;
public class ButtonDemo extends Applet
{
public void init()
{
Button b1 = new Button("Ok");
Button b2 = new Button("Reset");
Button b3 = new Button("Cancal");
add(b1);
add(b2);
add(b3);
}
}
/*<applet code="ButtonDemo" width=250 height=150> </applet> */
4. Design an applet to demonstrate the use of Radio Button and checkbox
5. Design an applet to demonstrate the use of Text Field, Text Area, Button and
Label
import java.awt.*;
import java.applet.*;
public class TextFieldDemo extends Applet
{
TextField name, pass;
public void init()
{
Button b1=new Button("Inormation");
Label name = new Label("Name: ", Label.RIGHT);
Label pass = new Label("Password: ", Label.RIGHT);
Label addr = new Label("Address: ", Label.RIGHT);
name = new TextField(12);
pass = new TextField(8);
addr=new TextArea(4,4);
add(b1);
add(name);
add(pass);
add(addr);
}
}
/* <applet code="TextFieldDemo" width=380 height=150> </applet> */