Article View: borland.public.jbuilder.java.language
Article #15279Re: Press Button Automatically
From: Paul Hill
Date: Wed, 30 Jun 1999 00:00
Date: Wed, 30 Jun 1999 00:00
25 lines
2372 bytes
2372 bytes
Henning Halfpap wrote: > > MJ wrote: > > > > Does anyone know how I can "press" a button in my code...I have a button > [...] > Depending on that you usually divert to a method which actually performs > the action for your object, e.g. > > if (myEvent.getSource == myButton) actionMyButton(myEvent); > > so the method actionMyButton(java.awt.event.ActionEvent myEvent) is the > one you want to call if the "Enter" Key is pressed. And if you wrote actionMyButton yourself, you might even be able to determine if it really needs an event or can just be called with a null. When I find myself wanting to do the same as GUI event, I make sure that all of real activity of the event is inside of one non-GUI method of the class. When this is the case, any part of the code can call it. -- Paul A. Hill, Myriad Genetics Laboratories, http://www.myriad.com/
Technical Details
Message-ID:
<377A4134.A2CF3783@myriad.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7laik7$rg0$1@mailint03.im.hou.compaq.com> <3778DB0B.2B59F8C9@logics.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d6b,3deb09cf5370bdb2 X-Google-Attributes: gid111d6b,public X-Google-Thread: f5d71,3deb09cf5370bdb2 X-Google-Attributes: gidf5d71,public X-Google-Thread: fecd1,3deb09cf5370bdb2 X-Google-Attributes: gidfecd1,public X-Google-Thread: fa45f,3deb09cf5370bdb2 X-Google-Attributes: gidfa45f,public X-Google-Thread: 10a146,3deb09cf5370bdb2 X-Google-Attributes: gid10a146,public X-Google-Thread: f74b3,3deb09cf5370bdb2 X-Google-Attributes: gidf74b3,public X-Google-Thread: 10bb9b,3deb09cf5370bdb2 X-Google-Attributes: gid10bb9b,public X-Google-Thread: 113ae9,3deb09cf5370bdb2 X-Google-Attributes: gid113ae9,public From: Paul Hill <phill@myriad.com> Subject: Re: Press Button Automatically Date: 1999/06/30 Message-ID: <377A4134.A2CF3783@myriad.com> X-Deja-AN: 495648419 Content-Transfer-Encoding: 7bit References: <7laik7$rg0$1@mailint03.im.hou.compaq.com> <3778DB0B.2B59F8C9@logics.de> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@xmission.com X-Trace: news.xmission.com 930758984 6892 209.160.31.225 (30 Jun 1999 16:09:44 GMT) Organization: XMission http://www.xmission.com/ Mime-Version: 1.0 NNTP-Posting-Date: 30 Jun 1999 16:09:44 GMT Newsgroups: borland.public.jbuilder.java.language,comp.lang.java,comp.lang.java.api,comp.lang.java.help,comp.lang.java.machine,comp.lang.java.misc,comp.lang.java.programmer,microsoft.public.inetexplorer.ie4.java_applets