import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;


public class FocusApplet extends JApplet
{
    JPanel contentPanel = (JPanel)this.getContentPane();
    MyPanel touchPanel   = new MyPanel();
    JLabel touchLabel = new JLabel("Active Region");
        
    public void init() 
    {
	touchLabel.setHorizontalAlignment(SwingConstants.CENTER);
	touchPanel.setBackground(Color.white);
	touchPanel.add(touchLabel);
	contentPanel.setLayout(new GridLayout(2,0));
	contentPanel.add(touchPanel);
    }
    
    public class MyPanel extends JPanel
    {
	public MyPanel()
	{
	    super();
	    enableEvents(
		AWTEvent.ACTION_EVENT_MASK	    | AWTEvent.ADJUSTMENT_EVENT_MASK	| 
		AWTEvent.COMPONENT_EVENT_MASK	    | AWTEvent.CONTAINER_EVENT_MASK	| 
		AWTEvent.FOCUS_EVENT_MASK	    | AWTEvent.INPUT_METHOD_EVENT_MASK	| 
		AWTEvent.ITEM_EVENT_MASK	    | AWTEvent.KEY_EVENT_MASK		| 
		AWTEvent.MOUSE_EVENT_MASK	    | AWTEvent.MOUSE_MOTION_EVENT_MASK  | 
		AWTEvent.TEXT_EVENT_MASK	    | AWTEvent.WINDOW_EVENT_MASK);
	}
	protected void processEvent(AWTEvent evt)
	{
	    FocusApplet.this.showStatus(evt.toString());
	}
    }
}
