Manu

Saturday, November 19, 2016

Write a program using different AWT(Abstract Window Toolkit) Contoll.

Input :

\package javaapplication2;
import java.awt.*;
import java.applet.*;
public class MyControl_1 extends Applet
{
    @Override
    public void init()
    {
      setLayout(null);
      Button b1= new Button("Ok");
      b1.setBounds(10,20,50,20);
      Button b2= new Button("Cancel");
      b2.setBounds(70,20,50,20);
      Button b3= new Button("Reset");
      b3.setBounds(130,20,50,20);
      add(b1);
      add(b2);
      add(b3);
      TextField t1=new TextField(15);
      t1.setBounds(40,60,50,20);
      add(t1);
      Checkbox c1=new Checkbox("Hindi");
       c1.setBounds(10,90,50,20);
      Checkbox c2=new Checkbox("Gujrati");
       c2.setBounds(70,90,50,20);
      Checkbox c3=new Checkbox("English");
       c3.setBounds(130,90,50,20);
      add(c1);
      add(c2);
      add(c3);
      CheckboxGroup cbg=new CheckboxGroup();
       Checkbox cg1=new Checkbox("Male",cbg,true);
        cg1.setBounds(10,120,50,20);
       Checkbox cg2=new Checkbox("Female",cbg,false);
        cg2.setBounds(60,120,50,20);
       add(cg1);
       add(cg2);
    }
}

Output : 
 

No comments:

Post a Comment