Jump to content
  • Advertisement
Sign in to follow this  
drackill

[java] Giving applets Focus first

This topic is 4472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a random question but just working on a simple pong game and when I load the applet within a html page, I firstly have to click on the applet to do anything on it. I know this isn't a major problem but just wondering if there is a way so when the page loads the applet is straight away under the player control? Unsure if this would be better placed within the html forum but hopefully it should be ok here. Thanks in advance. Nate

Share this post


Link to post
Share on other sites
Advertisement
I think there is some java script you can call to set the input focus on a page so that could be the place to start

:-)

Share this post


Link to post
Share on other sites
irrc you can use the focus function of the DHTML applet tag in order to give focus to the applet though I am not sure if this will cause java to set the focus.

Example:

<applet
id="myapplet_id"
code="myapplet"
archive="mypackage.jar"
width=600
height=400
>
Get java stupid!
</applet>





And the javascript for the page

onload = document.all("myapplet_id").focus();





I think that should help! Let me know if that works!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!