KeyEvent Handling execption

Referance to my previous thread I post
When I press any sort of key following type of execption is raised


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Screen.keyReleased(Screen.java:39)
at java.awt.Component.processKeyEvent(Component.java:5999)
at java.awt.Component.processEvent(Component.java:5815)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Window.processEvent(Window.java:1787)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.ja
va:1848)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboard
FocusManager.java:693)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeybo
ardFocusManager.java:958)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeybo
ardFocusManager.java:830)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFoc
usManager.java:657)
at java.awt.Component.dispatchEventImpl(Component.java:4282)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)


Kindly help me in this.

Regards
Danish Kamran

Comments

  • : Referance to my previous thread I post
    : When I press any sort of key following type of execption is raised
    :
    :
    : Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    : at Screen.keyReleased(Screen.java:39)
    : at java.awt.Component.processKeyEvent(Component.java:5999)
    : at java.awt.Component.processEvent(Component.java:5815)
    : at java.awt.Container.processEvent(Container.java:2058)
    : at java.awt.Window.processEvent(Window.java:1787)
    : at java.awt.Component.dispatchEventImpl(Component.java:4410)
    : at java.awt.Container.dispatchEventImpl(Container.java:2116)
    : at java.awt.Window.dispatchEventImpl(Window.java:2429)
    : at java.awt.Component.dispatchEvent(Component.java:4240)
    : at
    : java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.ja
    : va:1848)
    : at
    : java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboard
    : FocusManager.java:693)
    : at
    : java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeybo
    : ardFocusManager.java:958)
    : at
    : java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeybo
    : ardFocusManager.java:830)
    : at
    : java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFoc
    : usManager.java:657)
    : at java.awt.Component.dispatchEventImpl(Component.java:4282)
    : at java.awt.Container.dispatchEventImpl(Container.java:2116)
    : at java.awt.Window.dispatchEventImpl(Window.java:2429)
    : at java.awt.Component.dispatchEvent(Component.java:4240)
    : at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    : at
    : java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
    : ad.java:273)
    : at
    : java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
    : java:183)
    : at
    : java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    : ad.java:173)
    : at
    : java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    :
    :
    : Kindly help me in this.
    :
    : Regards
    : Danish Kamran
    :
    Based on the exception class "java.lang.NullPointerException" and its location "Screen.keyReleased" it looks like that one of the objects in that method is null. Check if e or T are null.
  • You've inititated T as a local variable rather than a class variable. Thus the key press functions think of T as null.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories