AUtomatic focus to Applets when loaded

Does anyone know how I could make my applet gain focus automatically when it has loaded.

The current versino of my project requires the user to click on the applet once, before the keys that control the game gets through…

I really hope that this is a problem that can be solved…

/Markus

Try to do a requestFocus() just before start the main loop of the game.

Tried that… don’t work…
I tried it both as:

applet.requestFocus();

and

aniamtionCanvas.requestFocus();

and I still have to click inside the applet to gain focus…

Hmmm…! Any other suggestions?
/Markus

i suppose u can do it by javascript, there is a method called focus() for any window object

I havn’t tried it myself, but I’ve read about other people that tried the javascript approach without success… :frowning:

[quote]Does anyone know how I could make my applet gain focus automatically when it has loaded.
[/quote]
This isn’t the best topic to be posting in. You could try newless cluebies, and might get a better response (more people read it).

Well… I don’t meen to be rude, but I thought that “online game development” should be just that - development of online games and Applets sort of define the term “online”…

Therefore I thought that this was a good place to ask but maybe I was wrong…

[quote]Well… I don’t meen to be rude, but I thought that “online game development” should be just that - development of online games and Applets sort of define the term “online”…

Therefore I thought that this was a good place to ask but maybe I was wrong…
[/quote]
No worries. If you think about it, though, your question is not particular to online games - it’s about using one of the standard libraries.

This is just an obersvation based on reading past threads in this topic, but many people seem to read it as “problems specific to networked multiplayer games”. If it’s not game-specific (your question is not), most people seem to use “networking” instead. Equally, if it’s not to do with networking, servers, etc, people often go to the 2D, sound, etc topics.

Personally, I don’t see how applets have anything to do with online game, per se. An applet is just a java program that you run on your local computer. Sure, it displays in your web browser, but you could easily be opening a local HTML page, and all that happens when you open a page from a website is that the app(let) is downloaded to your computer before being run. To my mind, an online game is one where you MUST be online to play it - i.e. it communicates either with a server or other players in a p2p arrangement. By that definition most games are online and offline - except for the MMOG’s which are online only.

Anyway, I don’t mind what you call it or how you interpret it :). I was only making the suggestion because the kind of thing you are asking about is not typical for this topic and I’m pretty sure that fewer people read this topic than read the more general ones, like 2D and newless cluebies. Just thought it might help you.

Understood and appruchiated :wink: I realize what online gaming is all about but when you start to get that deperate feeling and nothing works… you have to post somewhere and online was the closest thing to applets as I could find.

Sorry if I mess things up for you :-/

/Markus

I could see the ability of an Applet to “steal focus” as potentially being a security problem and for that reason it may be specifically disallowed…