Re: Capturing all KeyEvents in the system

From: Babu Kalakrishnan (k.a.l.a_at_sankya.com)
Date: 10/28/04

  • Next message: Babu Kalakrishnan: "Re: Scrolling a panel"
    Date: Thu, 28 Oct 2004 11:00:39 +0530
    
    

    Kannan S wrote:
    >
    > class MyFrame extends JFrame {
    >
    > public boolean handleEvent(Event event) {
    >
    > if(event.id == Event.KEY_PRESS) {
    > System.out.println("KeyPressed: " + event.key);
    > } else if(event.id == Event.KEY_RELEASE) {
    > System.out.println("KeyReleased: " + event.key);
    > }
    >
    > return super.handleEvent(event);
    > }
    > }

    The handleEvent method was the JDK 1.0 way of processing events and was
    replaced by dispatchEvent/processEvent in 1.1. As far as I could see
    from JDK 1.4 sources, no events are passed to the handleEvent method.

    Did you try overriding the processEvent method instead ?

    BK


  • Next message: Babu Kalakrishnan: "Re: Scrolling a panel"