Article View: borland.public.jbuilder.java.swing
Article #9540Re: Problem adding an ActionListener to a JButton
From: Jeff Marendo
Date: Fri, 10 Mar 2000 00:00
Date: Fri, 10 Mar 2000 00:00
37 lines
1801 bytes
1801 bytes
Paul,
It's likely that my thinking is off with how I'm interpreting the usage of
global variables here. Originally, I was creating my ActionListener within
a method called setInsertButton like so:
private void setInsertButton(JButton button)
button.setPreferredSize(d);
button.setBorder(null);
// Create the ActionListener for this button
ActionListener insertBtnal = new ActionListener() {
public void actionPerformed(ActionEvent ae) {
insertBtn_actionPerformed(ae);
}
};
button.addActionListener(insertBtnal);
...
}
The insertBtn_actionPerformed method is included in the same class where the
setInsertButton method is defined and used. Right now, it is simply:
void insertBtn_actionPerformed(ActionEvent e) {
System.out.println("Inside insertBtn_actionPerformed");
}
That probably doesn't help much, but if you or anyone else can take a guess
at what I could be doing wrong, I'd really appreciate it. The only
alternative I can think of right now is to take out the methodology for
using my "setInsertButton(JButton b)" method and just define everything in
jbInit( ).
Jeff
Technical Details
Message-ID:
<8ab2np$i8b5@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8a3nmf$54a7@bornews.borland.com> <38C81C6A.DEA90251@home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e0b4324bb89268d4 X-Google-Attributes: gid111d45,public From: "Jeff Marendo" <marendoj@commos.com> Subject: Re: Problem adding an ActionListener to a JButton Date: 2000/03/10 Message-ID: <8ab2np$i8b5@bornews.borland.com> X-Deja-AN: 595712620 References: <8a3nmf$54a7@bornews.borland.com> <38C81C6A.DEA90251@home.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Organization: CommTech Corporation X-MSMail-Priority: Normal Reply-To: "Jeff Marendo" <marendoj@commos.com> Newsgroups: borland.public.jbuilder.java.swing