Article View: borland.public.jbuilder.java.language
Article #18044Backspace key
From: John Sinues
Date: Tue, 25 Aug 1998 00:00
Date: Tue, 25 Aug 1998 00:00
16 lines
873 bytes
873 bytes
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:
<35E3137A.9E0E6FA5@prc.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,c6b71b33a58317af,start X-Google-Attributes: gidf74b3,public From: John Sinues <sinues_john@prc.com> Subject: Backspace key Date: 1998/08/25 Message-ID: <35E3137A.9E0E6FA5@prc.com> X-Deja-AN: 384656469 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language