Make buttons work in a runnable applet
Posted on 2004-04-18
OK, it's been a long time since I did anything with java and I run into a stumper. I have an applet (public class animate extends Applet implements Runnable ) and in general terms it operates a counter within it that determines the behaviour of the applet. Anyways, my problem is that I would like to load the applet and make it start based on a button but I can't figure out how. In my init() I have a button (one button only)
Now the compiler complains as follows: "Value for argument 1 cannot be converted from 'animate' in call to 'voidButton.addActionListener(ActionListener)" This error refers to StartB.addActionListener(this); I think the problem is that it implements Runnable instead of a ActionListener, but I think I had it working once (when I did more java) under runnable without implementing action listener.
OK, what am I missing and what is the simplest fastest solution to this problem? Btw, I'm running Visual J++ on a win2k Virtual Machine.