Article View: borland.public.jbuilder.java.swing
Article #9443class JKeyField extends JTextField
From: Manuel Wellmann
Date: Mon, 20 Mar 2000 00:00
Date: Mon, 20 Mar 2000 00:00
26 lines
1255 bytes
1255 bytes
Dear NewsReader,
i've got the following problem: i want to modifie the class "JTextField" to
a class which inserts in the field not the input but the ascii-code of the
last key pressed. therefor i wrote this class:
class JKeyField extends JTextField implements KeyListener
{
public char c;
public void keyPressed(KeyEvent evt)
{
this.setText(String.valueOf(evt.getKeyCode()));
}
public void keyTyped(KeyEvent evt)
{
}
public void keyReleased(KeyEvent evt)
{
}
}
the problem is: not only the ascii-code is shown, but also the character it
self ( i.e 'k' produces '75k'). i thing i have to overide another procedure
but dunno which on.
thnak you for reading, manuel (wellmann)
Technical Details
Message-ID:
<8b6613$8he$1@unlisys.unlisys.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c1a955613704b692,start X-Google-Attributes: gid111d45,public From: "Manuel Wellmann" <wellmann@snafu.de> Subject: class JKeyField extends JTextField Date: 2000/03/20 Message-ID: <8b6613$8he$1@unlisys.unlisys.net> X-Deja-AN: 600108723 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: [Posted via] Interactive Networx X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing