Article View: borland.public.jbuilder.java.swing
Article #11655Re: Easy one JTextField
From: Tor Iver Wilhelmsen
Date: Thu, 15 Apr 1999 00:00
Date: Thu, 15 Apr 1999 00:00
17 lines
997 bytes
997 bytes
<modulo2@cgocable.net> writes:
> If a user enters some text and then I want to enable a JButton
> if the user backspaces on the same textbox and all the text is goin the
> JButton is Disabled
myJTextField.addTextListener(
new java.awt.event.TextListener() {
public void textValueChanged(TextEvent evt) {
String s = myJTextField.getText();
myJButton.setEnabled(s != null && s.length() > 0);
}
}
);
You can probably make a more elegant specific TextListener class if
you want a more generic solution.
Technical Details
Message-ID:
<un20aqqrn.fsf@sds.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7f3ckd$ha26@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,9cbda61f5ef07883 X-Google-Attributes: gid111d45,public From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> Subject: Re: Easy one JTextField Date: 1999/04/15 Message-ID: <un20aqqrn.fsf@sds.no> X-Deja-AN: 466628900 Sender: towi@SDSA1761 References: <7f3ckd$ha26@forums.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing