🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #136

Confused btwn actionPerformed and actionAdapter

#136
From: Daniel
Date: Wed, 02 Jan 2008 14:17
24 lines
1731 bytes
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: <477bab15$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,92daee7594067bd5,start
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: Confused btwn actionPerformed and actionAdapter
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 82.72.42.113     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <477bab15$1@newsgroups.borland.com>
Date: 2 Jan 2008 07:17:41 -0700
X-Trace: newsgroups.borland.com 1199287061 207.105.83.66 (2 Jan 2008 07:17:41 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail