Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411579 Posts in 69386 Topics- by 58445 Members - Latest Member: Mansreign

May 05, 2024, 01:09:28 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)[Java] JApplet Not Stopping or Reacting to Keyboard Input
Pages: [1]
Print
Author Topic: [Java] JApplet Not Stopping or Reacting to Keyboard Input  (Read 1258 times)
tametick
Level 3
***


Could take weeks, sir!


View Profile WWW
« on: June 27, 2009, 01:06:05 PM »

Hi,
I've been messing around with awt/swing lately trying to learn how to do applets for my next game.

I have the following JApplet, which on the surface seems to work.

The problems I have occur when I try to exit it:

1. Pressing ESC does nothing, in fact line 38 is never reached when I run it in the debugger (nor is line 94 - it seems as if the overridden function processKeyEvent(KeyEvent e) is not being called by the applet runner upon keypress at all).  However, mouse events do seem to be processed (via the debugger I can see line 99 being reached when i move the mouse).
2. Trying to close/quit eclipse's applet runner causes it to hang, meaning i have to kill the process. That didn't happen when running another applet through it.
3. the printed '@' is not at the right size, and I suspect it is not drawing using the fixed width font I set it up to use in line 74.

Any idea what I'm doing wrong?

-Ido.
« Last Edit: June 27, 2009, 01:30:32 PM by ido » Logged

Paolo Victor
Level 1
*

This is a test.


View Profile WWW
« Reply #1 on: June 27, 2009, 02:57:59 PM »

Quitting by pressing "ESC" worked on my machine (Windows, Java 1.6, Eclipse 3.3.1.1), but first I had to click inside the window, first. Could you try it?
Logged
tametick
Level 3
***


Could take weeks, sir!


View Profile WWW
« Reply #2 on: June 27, 2009, 11:21:18 PM »

Didn't help- I'll try with an older Eclipse version and failing that, on Windows.

Can you also quit by closing the applet viewer window?
Logged

Paolo Victor
Level 1
*

This is a test.


View Profile WWW
« Reply #3 on: June 28, 2009, 05:01:40 AM »

Closing the window didn't work, but maybe you should handle the specific window event?
Logged
tametick
Level 3
***


Could take weeks, sir!


View Profile WWW
« Reply #4 on: June 28, 2009, 10:37:17 AM »

Are there window events for Applets though?
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic