Article View: borland.public.jbuilder.java.language
Article #18046Re: Backspace key
From: Richard Wilkman
Date: Tue, 25 Aug 1998 00:00
Date: Tue, 25 Aug 1998 00:00
39 lines
1593 bytes
1593 bytes
John: Look at java.awt.event.KeyEvent and it's mapping of Virtual Keys (VK). You are looking for VK_BACK_SPACE -Rich John Sinues wrote: > > 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. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Rich Wilkman Senior Quality Assurance Engineer Borland JBuilder Team If you see something that looks like an opinion up there, it's mine and mine alone. Mail sent to me from the newsgroups won't bounce but will be ignored. If I have time, I'll respond, but you have a better chance if you confine your posts to the newsgroups =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID:
<35E329E9.E4CD1AC5@inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35E3137A.9E0E6FA5@prc.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,c6b71b33a58317af X-Google-Attributes: gidf74b3,public From: Richard Wilkman <rwilkman@inprise.com> Subject: Re: Backspace key Date: 1998/08/25 Message-ID: <35E329E9.E4CD1AC5@inprise.com> X-Deja-AN: 384686091 Content-Transfer-Encoding: 7bit References: <35E3137A.9E0E6FA5@prc.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language