Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  AUtomatic focus to Applets when loaded  (Read 2221 times)
0 Members and 1 Guest are viewing this topic.
Offline Murdockian

Senior Newbie




Java games rock!


« Posted 2003-10-15 04:15:33 »

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
Offline caraiz

Senior Newbie




Java games rock!


« Reply #1 - Posted 2003-10-15 06:22:55 »

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

Offline Murdockian

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-10-15 08:28:36 »

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
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline caraiz

Senior Newbie




Java games rock!


« Reply #3 - Posted 2003-10-15 09:20:58 »

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

Offline Murdockian

Senior Newbie




Java games rock!


« Reply #4 - Posted 2003-10-15 09:35:14 »

I havn't tried it myself, but I've read about other people that tried the javascript approach without success... Sad
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #5 - Posted 2003-10-15 14:08:28 »

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


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

malloc will be first against the wall when the revolution comes...
Offline Murdockian

Senior Newbie




Java games rock!


« Reply #6 - Posted 2003-10-16 09:23:40 »

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...
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #7 - Posted 2003-10-16 10:11:47 »

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


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

malloc will be first against the wall when the revolution comes...
Offline Murdockian

Senior Newbie




Java games rock!


« Reply #8 - Posted 2003-10-16 10:17:24 »

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
Offline Jeff

JGO Coder




Got any cats?


« Reply #9 - Posted 2003-10-30 04:40:32 »

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

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (73 views)
2014-11-26 15:22:04

toopeicgaming1999 (62 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (56 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!