Article View: borland.public.jbuilder.java.language
Article #19344I need some serious help.
From: Walter Draffin
Date: Thu, 12 Feb 1998 00:00
Date: Thu, 12 Feb 1998 00:00
43 lines
2140 bytes
2140 bytes
I am working with someone who is currently learning java and he is
wanting me to extend the textfield class for the following reason:
What we are trying to accomplish is a KeyListener on every text
field, which is going to be in the 100-200 range once completed, that
checks to see if the ENTER key was pressed and then transfers the focus,
transferFocus( ), to the next field all the way down the tabbing order,
instead of pressing the TAB key. He is telling me this can be done all
in one class that extends the textfield class and it will eliminate all
the code for each textfield as it stands. ex:
void pass_textField1_keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER){
//Whatever I want it to do, in this case change focus
}
}
class Applet1_pass_textField1_keyAdapter extends
java.awt.event.KeyAdapter {
Applet1 adaptee;
Applet1_pass_textField1_keyAdapter(Applet1 adaptee) {
this.adaptee = adaptee;
}
public void keyReleased(KeyEvent e) {
adaptee.pass_textField1_keyReleased(e);
}
}
From what he is telling me, this code will only be in here once and each
instance of the new class will use it. I am having understanding how it
is going to do this or if it is even a legitimate request. I do agree
with him as far as that is a lot of code for every textfield just for
what we want it to do. Does anyone understand my question and could
possible help me?
Many Thanks in Advance,
Walter Draffin
Telegraph New Technologies
Technical Details
Message-ID:
<34E30FEA.A4FC5C9F@telegraph.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: 146a3d,8cbfdb8ef441a77c,start X-Google-Attributes: gid146a3d,public X-Google-Thread: f74b3,8cbfdb8ef441a77c,start X-Google-Attributes: gidf74b3,public From: Walter Draffin <draffin@telegraph.net> Subject: I need some serious help. Date: 1998/02/12 Message-ID: <34E30FEA.A4FC5C9F@telegraph.net> X-Deja-AN: 324454500 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: None Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.java.applet-issues