Complete Applet

Following is a program that combines these components:

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class step1 extends Applet implements ActionListener, MouseListener {

// Illustrates Additonal User Interface Components

MyFrame outerBox;

Label title;

Panel sexPanel;
Label sexLabel;
CheckboxGroup sexGroup;
Checkbox female;
Checkbox male;

Panel colorPanel;
Label colorLabel;
Choice favoriteColor;

Panel langPanel;
Label langLabel;
List favoriteLang;

TextArea lifeHistory;

PopupMenu popup;
MenuItem cut, copy, paste;


  public void init ( ){

    outerBox = new MyFrame ( );

    title = new Label ( "Personal Information", Label.CENTER);

    sexPanel = new Panel ( );
    sexLabel = new Label ( "Sex:");
    sexGroup = new CheckboxGroup ( );
    female = new Checkbox ( "female", sexGroup, false );
    male = new Checkbox ( "male", sexGroup, false );

    Panel colorPanel = new Panel ( );
    Label colorLabel = new Label ( "Favorite Color:");
    Choice favoriteColor = new Choice ( );

    langPanel = new Panel ( );
    langLabel = new Label ( "Favorite Language:");
    favoriteLang = new List ( 5, false );

    lifeHistory = new TextArea ( "Your Life History", 10, 40 );

    popup = new PopupMenu ();
    cut = new MenuItem ( "cut" );
    cut.addActionListener ( this );
    copy = new MenuItem ( "copy" );
    copy.addActionListener ( this );
    paste = new MenuItem ( "paste" );
    paste.addActionListener ( this );


    outerBox.addWindowListener ( outerBox );
    outerBox.setLayout ( null );
    outerBox.setBackground ( Color.white );
    outerBox.setFont (new Font ("Helvetica", Font.PLAIN, 18) );
    outerBox.resize (600, 500);
    outerBox.addMouseListener ( this );

    outerBox.add (title);

    sexPanel.setLayout ( new GridLayout ( 3, 1 ) );
    sexPanel.setBackground ( Color.yellow );
    sexPanel.add ( sexLabel );
    sexPanel.add ( female );
    sexPanel.add ( male );
    outerBox.add (sexPanel);

    colorPanel.setLayout ( new GridLayout ( 2, 1 ) );
    colorPanel.setBackground ( Color.red );
    favoriteColor.addItem ( "red" );
    favoriteColor.addItem ( "green" );
    favoriteColor.addItem ( "blue" );
    colorPanel.add (  colorLabel );
    colorPanel.add (  favoriteColor);
    outerBox.add (colorPanel);

    langPanel.setLayout ( new BorderLayout (  ) );
    langPanel.setBackground ( Color.green );
    favoriteLang.addItem ( "C" );
    favoriteLang.addItem ( "C++" );
    favoriteLang.addItem ( "Java" );
    favoriteLang.addItem ( "Pascal" );
    favoriteLang.addItem ( "Perl" );
    langPanel.add ( "North", langLabel );
    langPanel.add ( "South", favoriteLang);
    outerBox.add (langPanel);

    lifeHistory.setBackground ( Color.lightGray );
    outerBox.add (lifeHistory);

    popup.add ( cut );
    popup.add ( copy );
    popup.add ( paste );
    outerBox.add ( popup );

    title.setBounds ( 200, 20, 200, 30 );
    colorPanel.setBounds (50,100, 150, 100);
    sexPanel.setBounds (300, 100, 100, 100 );
    langPanel.setBounds (50, 300, 200, 200 );
    lifeHistory.setBounds ( 300, 300, 200, 200 );

    outerBox.show( );

  } // end init



  //***********  Interface Methods   ***********

  //****  MouseListener methods

  int lastX, lastY;

    public void mousePressed ( MouseEvent e )  {
    }  // end mousePressed

    public void mouseReleased ( MouseEvent e )  {
        if ( e.isPopupTrigger() )  {
            eraseMessage ();
            lastX = e.getX();
            lastY = e.getY();
            popup.show ( outerBox, e.getX(), e.getY() );
        }  // end process popupmenu actions
    }  // end mouseReleased

    public void mouseEntered ( MouseEvent e )  {
    }  // end mouseEntered

    public void mouseExited ( MouseEvent e )  {
    }  // end mouseExited

    public void mouseClicked ( MouseEvent e )  {
    }  // end mouseClicked



  //****  ActionListener methods

  public void actionPerformed ( ActionEvent e )  {

    Object s = e.getSource();

    Graphics g = outerBox.getGraphics ();
    if ( s == cut ) g.drawString( "Cut selected", lastX, lastY );
    if ( s == copy )  g.drawString( "Copy selected", lastX, lastY );
    if ( s == paste )  g.drawString( "Paste selected", lastX, lastY );

  }  // end actionPerformed


  //***********  Utility Methods   ***********


  public void eraseMessage ()  {
    if ( lastX == 0 && lastY == 0 ) return;
    Graphics g = outerBox.getGraphics ();
    Color c = outerBox.getBackground();
    g.setColor ( c );
    g.fillRect ( lastX, lastY-30, 150, 40 );
    c = outerBox.getForeground();
    g.setColor ( c );
  }  // end eraseMessage


}  // end step1

Run the applet