Java practical 1

 avatar
Rohit143
java
2 years ago
1.5 kB
25
Indexable
Never
import java.awt.*;

class MyForm extends Frame   {
    Label heading,Lname,Llast;
    Button submit;
    TextField name,last;
    TextArea address;
    Checkbox checkbox1 ,checkbox2;
    CheckboxGroup gcb;
    // Rohit Nandagawali
   
    public MyForm(){
        setLayout(new FlowLayout());
        setSize(300,400);
        setVisible(true);
        heading = new Label("Please Fill the login Form By Rohit N.");
        Lname = new Label("Enter your First Name");
        name = new TextField("First Name",15);
        name.setForeground(Color.GRAY);
        Llast = new Label("Enter your Last Name");
        last = new TextField("Last Name",15);
        last.setForeground(Color.GRAY);

        setBackground(Color.BLACK);
        setForeground(Color.WHITE);

        address=new TextArea("Enter Your address here",10,34);
        address.setForeground(Color.GRAY);
        submit  = new Button("OK");
        submit.setBackground(Color.blue);

        gcb = new CheckboxGroup();
        checkbox1 = new Checkbox("male",gcb,true);    
        checkbox2 = new Checkbox("Female",gcb,false);    


        add(heading);

        add(Lname);
        add(name);

        add(Llast);
        add(last);

        add(checkbox1);
        add(checkbox2);

        add(new Label("Please enter your current Address"));
        add(address);

        add(submit);


    }
}
public class practical1 {
    public static void main(String[] args) {
        new MyForm();
    }
    
}