-
i n v i s i b l e
Tech Admin
The structure of the MakingBank class is all wrong - it's been written as a regular standalone Java application. It'll run by itself, but as soon as you try to run it as an applet the Java VM doesn't know what to do with it. Here's a few things that need to change:
- Currently the class declares only a main() method. Applets should declare the init(), start(), stop() and destroy() methods. init() is called when the applet is loaded and start() is called when it first becomes visible (after init()).
- Also, an ActionListener is used in the main() method of the class, but it doesn't implement the ActionListener interface in the class definition. You'd need to have your class definition as "public class MakingBank extends JApplet implements ActionListener" if you are going to want it to do anything dynamically.
- If you are wanting to be able to click on stuff then you probably should include the MouseListener interface as well: "public class MakingBank extends JApplet implements ActionListener,MouseListener"
- Implementing ActionListener and MouseListener also means you'll have to declare the associated methods for each interface. For ActionListener it's actionPerformed() and for MouseListener they are mouseClicked(), mouseEntered(), mouseExited(), mousePressed(), mouseReleased().
- I'm assuming that the developer of this code has written a helper class "PressButton", because it doesn't seem to exist in any official APIs. 
Hopefully that helps whoever it needs to - the whole program needs quite an overhaul!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules