KeyEvent novice question

From: Lannsjö (nothing_at_tosay.com)
Date: 02/23/04


Date: Mon, 23 Feb 2004 15:09:54 GMT

Hi Im trying to learn Java and cant really figure out how to use keyEvents.
I want to know if a person has pressed y or n in a method.

void doCloseCommand (int status) {
      statusInfo.setText("Are you sure (y/n):");
      if (KeyEvent.getKeyChar() == 'y'){
       System.exit (status);
      }
  }

But the compiler says:
TextEditor.java:73: non-static method getKeyChar() cannot be referenced from
a static context

What shall I do?
/M2