import java.applet.*;
import java.awt.*;

public class AllGuiExample extends Applet{

//GUI components
   TextField uName_text,
             uPass_text;
   Choice comboBox;
   Container all_gui;
   Button okButton,
          cancelButton;
   List optionList;
   
   //CheckboxGroups
   CheckboxGroup radioGroup = new CheckboxGroup();

/*
  Form:all_gui
  Table:
          +---------------+
          |               |
          +---+---+-------+
          |   |   |       |
          +---+---+       |
          |   |   |       |
          +---+---+       |
          |       |       |
          +-------+       |
          |       |       |
          +-------+       |
          |       |       |
          +-------+---+---+
          |       |   |   |
          +-------+---+---+
          |       |   |   |
          +-------+   +---+
          |       |   |   |
          +-------+   +---+
          |       |   |   |
          +-------+---+---+
*/

   void guiInit(){
      //Some default names used
      Label label;
      TextArea text_area;
      Checkbox check;
      Font font;

      GridBagConstraints c = new GridBagConstraints();

      font = new Font("Dialog",Font.PLAIN,12);
      
      all_gui = this;
      //all_gui = new Panel();
      all_gui.setLayout(new GridBagLayout());
      all_gui.setFont(font);
      all_gui.setBackground(new Color(0xCCCCCC));
      c.insets = new Insets(2,2,2,2);
      
      c.gridx=0; c.gridy=0;
      c.gridwidth=4; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      label = new Label("Testing GUI Components");
      label.setFont(new Font("Monospaced",Font.BOLD,24));
      all_gui.add(label,c);
      
      c.gridx=0; c.gridy=1;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.EAST;
      label = new Label("User ID:");
      all_gui.add(label,c);
      
      c.gridx=1; c.gridy=1;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      uName_text = new TextField("user",10);
      all_gui.add(uName_text,c);
      
      c.gridx=2; c.gridy=1;
      c.gridwidth=2; c.gridheight=5;
      c.anchor=GridBagConstraints.WEST;
      text_area = new TextArea("TEXTAREA --> "+
      "\n Textarea -->"+
      "\n   TextArea -->",7,30);
      text_area.setFont(new Font("Monospaced",font.getStyle(),font.getSize()));
      all_gui.add(text_area,c);
      
      c.gridx=0; c.gridy=2;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.EAST;
      label = new Label("Password:");
      all_gui.add(label,c);
      
      c.gridx=1; c.gridy=2;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      uPass_text = new TextField("",10);
      uPass_text.setEchoChar('*');
      //uPass_text.setEchoCharacter('*');//1.0
      all_gui.add(uPass_text,c);
      
      c.gridx=0; c.gridy=3;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      label = new Label("Some Options");
      label.setFont(new Font(font.getName(),Font.BOLD,18));
      all_gui.add(label,c);
      
      c.gridx=0; c.gridy=4;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      check = new Checkbox("Bold",false);
      check.setFont(new Font(font.getName(),Font.BOLD,font.getSize()));
      all_gui.add(check,c);
      
      c.gridx=0; c.gridy=5;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      check = new Checkbox("Italic",true);
      check.setFont(new Font(font.getName(),Font.ITALIC,font.getSize()));
      all_gui.add(check,c);
      
      c.gridx=0; c.gridy=6;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      check = new Checkbox("TeleType",false);
      check.setFont(new Font("Monospaced",font.getStyle(),font.getSize()));
      all_gui.add(check,c);
      
      c.gridx=2; c.gridy=6;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      label = new Label("ListBox ");
      label.setFont(new Font(font.getName(),Font.BOLD,font.getSize()));
      all_gui.add(label,c);
      
      c.gridx=3; c.gridy=6;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      label = new Label("ChoiceBox ");
      label.setFont(new Font(font.getName(),Font.BOLD,font.getSize()));
      all_gui.add(label,c);
      
      c.gridx=0; c.gridy=7;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      label = new Label("Exclusive Options");
      label.setFont(new Font(font.getName(),Font.BOLD|Font.ITALIC,18));
      all_gui.add(label,c);
      
      c.gridx=2; c.gridy=7;
      c.gridwidth=1; c.gridheight=4;
      c.anchor=GridBagConstraints.CENTER;
      optionList = new List(5,true);
      optionList.add("Option1");
      optionList.add("Option2");
      optionList.add("Option3");
      optionList.select(0);
      optionList.select(2);
      all_gui.add(optionList,c);
      
      c.gridx=3; c.gridy=7;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      comboBox = new Choice();
      comboBox.add("Select Option ");
      comboBox.add("Option1");
      comboBox.add("Option2");
      comboBox.add("Option3");
      comboBox.select(0);
      all_gui.add(comboBox,c);
      
      c.gridx=0; c.gridy=8;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      check = new Checkbox("Red",radioGroup,true);
      //1.0 compatible code
      //check = new Checkbox("Red",true);
      //check.setCheckboxGroup(radioGroup);
      check.setFont(new Font(font.getName(),Font.BOLD|Font.ITALIC,14));
      check.setForeground(new Color(0xFF0000));
      all_gui.add(check,c);
      
      c.gridx=3; c.gridy=8;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      okButton = new Button("OK");
      all_gui.add(okButton,c);
      
      c.gridx=0; c.gridy=9;
      c.gridwidth=2; c.gridheight=1;
      c.anchor=GridBagConstraints.WEST;
      check = new Checkbox("Green",radioGroup,false);
      //1.0 compatible code
      //check = new Checkbox("Green",false);
      //check.setCheckboxGroup(radioGroup);
      check.setFont(new Font(font.getName(),Font.BOLD|Font.ITALIC,14));
      check.setForeground(new Color(0x33FF33));
      all_gui.add(check,c);
      
      c.gridx=3; c.gridy=9;
      c.gridwidth=1; c.gridheight=1;
      c.anchor=GridBagConstraints.CENTER;
      cancelButton = new Button("Cancel");
      all_gui.add(cancelButton,c);
   }//end guiInit

//Applet functions
//////////////////
  public void init(){
     guiInit();
  }


//Main
/////////
   public static void main(String[] args){
     Applet allguiexample = new AllGuiExample();
     Frame main_frame = new Frame("allguiexample");
     allguiexample.init();
     main_frame.add("Center",allguiexample);
     main_frame.pack();
     main_frame.show();
   }
 }//end class
