Article View: borland.public.jbuilder.java.swing
Article #618Re: Disable a button??
From: Davisote
Date: Fri, 25 Mar 2005 18:36
Date: Fri, 25 Mar 2005 18:36
50 lines
2291 bytes
2291 bytes
Hi.
This should be the same code to disable the button, but sometimes
For example, if I delete all the text the button doesn't disable
void jTextField1_keyPressed(KeyEvent e) {
if (jTextField1.getText().length() > 0) {
jButton1.setEnabled(true);
}
else {
jButton1.setEnabled(false);
}
}
Thanks
"Lori M Olson [TeamB]" <javadragon@techie.com> escribi๏ฟฝ en el mensaje
news:4244454a$1@newsgroups.borland.com...
> Davisote wrote:
>
>> Hi.
>> I have a little problem. Just a JTextField and a JButton. if JTextField
>> is null or is blank the JButton must be disabled and when it has
>> something then enable the JButton.
>> What I do is test the length of the JTextField but it doesn't work
>> correctly.
>>
>> Anybody knows how is the correct method to do this??
>>
>> Thanks
>
> Why don't you post the code fragment that "doesn't work correctly" so we
> can see why...
>
> --
>
> Regards,
>
> Lori Olson [TeamB]
>
> ------------
>
> Save yourself, and everyone else, some time and search the
> newsgroups and the FAQ-O-Matic before posting your next
> question.
>
> Google Advanced Newsgroup Search
> http://www.google.ca/advanced_group_search
> Other Newsgroup Searches:
> http://www.borland.com/newsgroups/ngsearch.html
> Joi Ellis's FAQ-O-Matic:
> http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID:
<42445a44@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42441118@newsgroups.borland.com> <4244454a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,cb273dd3cca84955 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII From: "Davisote" <yeses@hotmail.com> Newsgroups: borland.public.jbuilder.java.swing References: <42441118@newsgroups.borland.com> <4244454a$1@newsgroups.borland.com> Subject: Re: Disable a button?? Date: Fri, 25 Mar 2005 18:36:55 -0000 Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 80.103.163.72 Message-ID: <42445a44@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1111775812 80.103.163.72 (25 Mar 2005 10:36:52 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail