• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there a code to auto click an applet in HTML?

 
Anna Flanneur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Is there a way in JavaScript or HTML to auto initialize an applet without the user having to click on the applet first?

Thank you,
 
Sachin Adat
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anna Flanneur wrote:
Is there a way in JavaScript or HTML to auto initialize an applet without the user having to click on the applet first?

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.
 
Anna Flanneur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sachin Adat wrote:
Anna Flanneur wrote:
Is there a way in JavaScript or HTML to auto initialize an applet without the user having to click on the applet first?

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.


Hi everyone,

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".


Thank you,

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "activate" - what is the applet not doing that you want done automatically?
 
Anna Flanneur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:What do you mean by "activate" - what is the applet not doing that you want done automatically?


The applet is loaded on the site with one color which is a plain output, but if clicked on it will be in a different color that indicate a different output.

example:

The applet is loaded on a zero timer but once activated the applets count from 1 to 10, but in order for it to start counting I/user have to click on the applet to start/activate it.

I am really bad at explaining this...sorry

What I want to do is have the applet load as usual then auto click to start without the help of the user. So it is ready to be used by the user.

Thanks for assisting me.

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anna --

Why not just recode the applet to start by itself, instead of requiring a click?
 
Anna Flanneur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest Friedman-Hill wrote:Anna --

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.


Thanks ,
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Early on in your start() method you could create and post an ActionEvent:

ActionEvent event = new ActionEvent(source, System.currentTimeMillis(), "action string");

Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event);

"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic