Article View: borland.public.jbuilder.java.language
Article #19432ActionAdapter
From: Paul Murray
Date: Sat, 07 Feb 1998 00:00
Date: Sat, 07 Feb 1998 00:00
34 lines
1283 bytes
1283 bytes
My fun tip:
when you create an event on a button (or anything else), JBuilder generates
an actionadapter class
In JBInit() {
button1.addActionListener(new Frame1_button1_actionAdapter(this));
}
class Frame1_button1_actionAdapter implements java.awt.event.ActionListener
{
Frame1 adaptee;
Frame1_button1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.button1_actionPerformed(e);
}
}
I like to replace this with an anonymous class.
In JBInit() {
button1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e)
{button1_actionPerformed(e);}}
);
}
Of course, the java engine does exactly the same work as creating the class
in code does, but I think it's cute.
--
http://www.users.bigpond.com/pmurray
Technical Details
Message-ID:
<6bhgoi$aja11@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,698f6173f73057c7 X-Google-Attributes: gidf74b3,public From: "Paul Murray" <pmurray@bigpond.com> Subject: ActionAdapter Date: 1998/02/07 Message-ID: <6bhgoi$aja11@forums.borland.com> X-Deja-AN: 322892210 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Organization: N/A Newsgroups: borland.public.jbuilder.java.language