Re: KeyEvent novice question
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/23/04
- Next message: Dr. Mercury: "Re: Anyone for a small Java challenge?"
- Previous message: Haider Kazmi: "Re: java.exe on XP"
- In reply to: Lannsjö: "KeyEvent novice question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 23 Feb 2004 11:08:11 -0600
"Lannsjö" <nothing@tosay.com> wrote in message
news:6Jo_b.83758$dP1.228444@newsc.telia.net...
> 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
>
>
Start here:
http://java.sun.com/docs/books/tutorial
Specifically, you'll be looking for information about event listeners here:
http://java.sun.com/docs/books/tutorial/uiswing/index.html
Come back when you have some idea what you're doing.
- Next message: Dr. Mercury: "Re: Anyone for a small Java challenge?"
- Previous message: Haider Kazmi: "Re: java.exe on XP"
- In reply to: Lannsjö: "KeyEvent novice question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|