KeyEvent novice question
From: Lannsjö (nothing_at_tosay.com)
Date: 02/23/04
- Next message: Haider Kazmi: "Re: java.exe on XP"
- Previous message: Jean Paul: "java and chinese"
- Next in thread: Ryan Stewart: "Re: KeyEvent novice question"
- Reply: Ryan Stewart: "Re: KeyEvent novice question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Haider Kazmi: "Re: java.exe on XP"
- Previous message: Jean Paul: "java and chinese"
- Next in thread: Ryan Stewart: "Re: KeyEvent novice question"
- Reply: Ryan Stewart: "Re: KeyEvent novice question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]