Re: KeyEvent novice question

From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/23/04


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.



Relevant Pages

  • KeyEvent novice question
    ... Hi Im trying to learn Java and cant really figure out how to use keyEvents. ... TextEditor.java:73: non-static method getKeyChar() cannot be referenced from ...
    (comp.lang.java)
  • RE: activeX
    ... So i deleted it again and all of a sudden my Java stops working and i cant ... even open Outlook properly. ... Windows update ...
    (microsoft.public.windowsupdate)
  • Re: BizTalk 2004 :: SOAP web service attachments advice needed
    ... then the (java) server dictates the technology used. ... >> Marvin Smit ... I cant get the adapter to work correctly anyway. ... >>>I am consuming a web service coming from an outside location, ...
    (microsoft.public.biztalk.general)
  • Re: Java on WM5 based PPC??
    ... I use opera mini and it works great. ... I'm using Opera browser on my HTC Wizard 100 and I cant open any java ... I tried using IE and Netfront on my PPC but i cant make it to work.. ...
    (microsoft.public.pocketpc)
  • Re: Threads in java
    ... I am facing problem in Threads in java. ... I have studied threads and know ... But I just cant get started. ...
    (comp.lang.java.programmer)