• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Always look on the bright side of life. At least this ad is really tiny:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic