๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17962

Re: Backspace key

#17962
From: Martin Fuente
Date: Tue, 08 Sep 1998 00:00
22 lines
1085 bytes
Hello, you must write
      int c = e.getKeyCode()   OR
  Then you can test with
    if (e.getKeyCode() == e.VK_BACK_SPACE)

John Sinues escribi๏ฟฝ en mensaje <35E3137A.9E0E6FA5@prc.com>...
>How do you trap the backspace key in the
>keyPressed() event?  I'm trying to only
>enable numbers, a period, and a backspace
>in a control.
>
>My codes so far looks like:
>
>    char c = e.getKeyChar();
>
>
>    if ( !Character.isDigit( c ) /* number */
>            || ( new Character(c).charValue() != '.' )   /* period */
>            ||  ?? )   /* backspace */ )
>        e.consume();
>
>TIA.
Technical Details
Message-ID: <6t2ejv$4ak1@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35E3137A.9E0E6FA5@prc.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,c6b71b33a58317af
X-Google-Attributes: gidf74b3,public
From: "Martin Fuente" <tinchete@hotmail.com>
Subject: Re: Backspace key
Date: 1998/09/08
Message-ID: <6t2ejv$4ak1@forums.borland.com>
X-Deja-AN: 388929891
References: <35E3137A.9E0E6FA5@prc.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language