This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
How do I program a button for closing down the applet? I always thought it was closed manually by the user clicking on the mouse, but I am supposed to write an applet that uses a "close" button to close down.
Well there is more than one way to do this. If you were going to use the X in the corner you would either create a class and extend WindowAdapter, or implement WindowListener. However, since you need a button to do this, you need to create a class to implement something that Button listens to. One of the things that Button listens to is an ActionListener. (You can check this by looking in the API and checking what addXXXListener methods the component has).
Now you have to create a gui and on that qui you need to make a button. When you have your button, you need to create an instance of your listener, and then hook the two together.
Now all you need is to get this in an Applet or a Frame, and all should be good.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Oct 12, 2001
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com