🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #619

Re: Disable a button??

#619
From: Lori M Olson [TeamB]
Date: Fri, 25 Mar 2005 21:59
36 lines
1916 bytes
Davisote wrote:

> 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);
>     }
>   }
> 

Try using a keyTyped event instead of a keyPressed.

-- 

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: <424489a2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <42441118@newsgroups.borland.com> <4244454a$1@newsgroups.borland.com> <42445a44@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,cb273dd3cca84955
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 25 Mar 2005 14:59:03 -0700
From: "Lori M Olson [TeamB]" <javadragon@techie.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax;nscd1)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: Disable a button??
References: <42441118@newsgroups.borland.com> <4244454a$1@newsgroups.borland.com> <42445a44@newsgroups.borland.com>
In-Reply-To: <42445a44@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 142.179.181.200
Message-ID: <424489a2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1111787938 142.179.181.200 (25 Mar 2005 13:58:58 -0800)
Lines: 36
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail