aspose file tools*
The moose likes Applets and the fly likes Is there a code to auto click an  applet in HTML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Is there a code to auto click an  applet in HTML?" Watch "Is there a code to auto click an  applet in HTML?" New topic
Author

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

Anna Flanneur
Greenhorn

Joined: May 16, 2009
Posts: 9
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

Joined: Sep 03, 2007
Posts: 213
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.


SCJP 6
How To Ask Questions On Java Ranch - How To Answer Questions On Java Ranch
Anna Flanneur
Greenhorn

Joined: May 16, 2009
Posts: 9
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
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
What do you mean by "activate" - what is the applet not doing that you want done automatically?


Ping & DNS - updated with new look and Ping home screen widget
Anna Flanneur
Greenhorn

Joined: May 16, 2009
Posts: 9
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

Joined: Jul 08, 2003
Posts: 24166
    
  30

Anna --

Why not just recode the applet to start by itself, instead of requiring a click?


[Jess in Action][AskingGoodQuestions]
Anna Flanneur
Greenhorn

Joined: May 16, 2009
Posts: 9
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
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a code to auto click an applet in HTML?
 
Similar Threads
make applet as a link to show on the html page
Applet focus; How to?
Applet focus; How to?
Applet to HTML
Menu applet refresh problem - please help