File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Applet in html page not reacting for keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet in html page not reacting for keys" Watch "Applet in html page not reacting for keys" New topic
Author

Applet in html page not reacting for keys

Rudolf Hergat
Greenhorn

Joined: Jun 21, 2012
Posts: 6
Hey

My friend have a problem with an applet and I coudln't help him. Here it is:

"I have a problem with an applet I put into an HTML page.

<applet id="applet" codebase="classes" code=Mappa/Jatek.class" width=800 height=600"></applet>

It's a game where the user controlls a stickman. Somehow the KeyPressed event doesn't seem to work and it doesn't react for the keys. Maybe the applet can't get the focus?

Thank you."

Thank you forwards for the answers.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

It's years since I worked on applets, but from what I remember, you need to click the applet to enable it to get focus. Can you try clicking it and see if it gets the key events?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rudolf Hergat
Greenhorn

Joined: Jun 21, 2012
Posts: 6
Yeah we tryed it but didn't help. We asked a couple of ppl to try the applet on their own computers. Turns out, the ones who have jre 6 can use the applet properly, but those who have jre 7 can't move the character.
 
Don't get me started about those stupid light bulbs.
 
subject: Applet in html page not reacting for keys