Article View: borland.public.jbuilder.java.language
Article #137Re: Confused btwn actionPerformed and actionAdapter
From: Daniel
Date: Wed, 02 Jan 2008 14:46
Date: Wed, 02 Jan 2008 14:46
41 lines
2315 bytes
2315 bytes
Hi all,
I also found out from Sun website that ActionListener does not have an adapter class. So why is the a declaration of this class in the event handler code?
class Frame2_jButton10_actionAdapter implements ActionListener { //etc }
Here's the link that says so: class
http://java.sun.com/docs/books/tutorial/uiswing/events/api.html
"Daniel " <dantsg@gmail.com> wrote:
>
>Dear fellow developers,
>
>When I clicked a component for instance a button, the event handler code as in below appears under Source tab. Could anyone please explain to me how it works and why does the action_Performed method appear two times, once by itself as a method and then another time under a class unknown to me called actionAdapter? All I want to do is just code one event handler that handles all button clicks, like so:
>public void button_actionPerformed(ActionEvent e, Object arg);
>{ ...... etc }
>
>Here's theh code generated by JBuilder when I double-clicked a button:
> public void jButton10_actionPerformed(ActionEvent e) {
> }
>}
>
>class Frame2_jButton10_actionAdapter implements ActionListener {
> private Frame2 adaptee;
> Frame2_jButton10_actionAdapter(Frame2 adaptee) {
> this.adaptee = adaptee;
> }
>
> public void actionPerformed(ActionEvent e) {
> adaptee.jButton10_actionPerformed(e);
> }
>}
>
>Thanks in advance for explaining to me.
>
>
>
Technical Details
Message-ID:
<477bb1dd@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<477bab15$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,92daee7594067bd5 X-Google-Attributes: gidf74b3,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Daniel" <dantsg@gmail.com> Sender: "Daniel" <dantsg@gmail.com> Reply-To: "Daniel" <dantsg@gmail.com> Subject: Re: Confused btwn actionPerformed and actionAdapter Newsgroups: borland.public.jbuilder.java.language X-User-Info: 82.72.42.113 References: <477bab15$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <477bb1dd@newsgroups.borland.com> Date: 2 Jan 2008 07:46:37 -0700 X-Trace: newsgroups.borland.com 1199288797 207.105.83.66 (2 Jan 2008 07:46:37 -0700) Lines: 42 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail