Anna Flanneur wrote:
The method is in the applet itself...... the init() method
You can declare the applet in your html which calls the init method of the applet.
I think I asked the question wrong.
I have this applet, after it is loaded on the site, the user have to click on the applet itself to get it activate.
Is there a way that I can activate the applet after it has been loaded in the browser, as in " self activate" or "self click".
Why not just recode the applet to start by itself, instead of requiring a click?
Here is a rephrasing of the question:
I have an interactive applet that responds to clicks of the mouse. Currently, after the applet loads, it just sits there waiting for the user to click on it. What I am looking for is a way to fool the applet into thinking that the first mouse click has already happened -- right after loading.
For example, imagine the first click of the mouse is supposed to flip a switch; then the subsequent clicks of the mouse cause some other stuff to happen. What I am looking for is a way to automatically flip the switch right after the applet loads -- before the user starts clicking the mouse.
Joined: Mar 22, 2005
Early on in your start() method you could create and post an ActionEvent:
"source" is the button that the user should have clicked to start the action, and "action string" is whatever you need in your event handler to trigger the appropriate action. Instead of ActionEvent you can use other subclasses of AWTEvent.
subject: Is there a code to auto click an applet in HTML?