newbie: err in ora book?

P

picaza

hi,
it is probably me but i copied the example from the tiger book and i get
an error. the info about the book is below along with the error msg.
any help?
tia,
peter

+++++++++++++++++++++++++++++++
page 48 june 2002 tiger book

javac HelloJava3.java
HelloJava3.java:40: addActionListener(java.awt.event.ActionListener) in
javax.swing.AbstractButton cannot be applied to (HelloComponent3)
theButton.addActionListener( this);
^


++++++++++++++++++++++++++++++++++++++++++
 
A

andreas kinell

hi,
it is probably me but i copied the example from the tiger book and i get
an error.

would be nice if you copied the example to the newsgroup too, i won't buy
the book just to help you...
+++++++++++++++++++++++++++++++
page 48 june 2002 tiger book

javac HelloJava3.java
HelloJava3.java:40: addActionListener(java.awt.event.ActionListener) in
javax.swing.AbstractButton cannot be applied to (HelloComponent3)
theButton.addActionListener( this);
^


++++++++++++++++++++++++++++++++++++++++++

i can only assume that "this" refers to your class extending AbstractButton
instead of
refering to the ActionListener.

i further assume that theButton.addActionListener(this) was a line of code
in an inner class implementing ActionListener
but now is not anymore, therefore doesn't work anymore. replace "this" with
the desired instance of your class implementing
ActionListener. this class cannot be anonymous anymore.

again, since i don't see any code, i could be completly wrong, it is mere
guessing.

andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top