import java.awt.*;                  // windowing toolkit
import java.io.*;                   // I/O classes and exceptions

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
public class EventExample extends Panel
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
{

////////////////////////////////////////////////////////////////
public EventExample()
////////////////////////////////////////////////////////////////
  {
    setLayout(new GridLayout(1,3,6,6));
    Button button1 = new Button("Button1"); add(button1);
    Button button2 = new Button("Button2"); add(button2);
    show();
  }

// List callback
////////////////////////////////////////////////////////////////
public boolean handleEvent(Event event) 
////////////////////////////////////////////////////////////////
  {
    System.out.println("handleEvent.event: " + event);
    System.out.println("KeyEvent.key: " + event.key);
    System.out.println("KeyEvent.modifiers: " + event.modifiers);
    if(event.key == java.awt.Event.F1)
      {
	System.out.println("F1 was pressed: ");
	if(event.modifiers == (event.ALT_MASK + event.CTRL_MASK))
	  {
	    System.out.println("event.ALT_MASK && event.CTRL_MASK: " );

	  }
      }
    return super.handleEvent(event); // calls Frame's handleEvent which will call action();
  } //HandleEvent  
  
////////////////////////////////////////////////////////////////
public boolean action(Event event, Object o)
////////////////////////////////////////////////////////////////
  {
    // load the buttons
    System.out.println("action.event: " + event);
    System.out.println("action.:object " + o);
    if( event.target instanceof Button ) 
      {
	System.out.println("action.ButtonPress: ");
      }
    return false;
  }

////////////////////////////////////////////////////////////////
public static void main(String args[])
////////////////////////////////////////////////////////////////
  {
	Frame my_frame = new Frame();
	EventExample app = new EventExample();
	my_frame.add("Center",app);

	my_frame.pack();
	my_frame.resize(200,200);
	my_frame.show();
    }

} // class EventExample



