HELP

I wrote a program, which is infact a game for my graphics class. It worked on Java 1.3, but did not on 1.4 or on the new 1.5.

Could anyone have a look at my code and let me know what might be wrong. Basically the Keystroke listener which works fine on 1.3 does not kick in or is not recogonized on 1.4 or 1.5.

You may find the code at
http://web.presby.edu/~kdwivedi/javaprogram.html

thanks!!

The code over there is broken.


v first.add(center,BorderLayout.WEST);


< if (shoot2 == true){

::slight_smile:

Well, try adding the KeyListener to one of the panels (instead of the frame) and/or try using .requestFocus().

Also use a meaningfull topic and use the right board (cluebies) - this one is for showing complete games.

Thanks for your reply, but I really don’t understand what
you are trying to say.

First of all - please reply in the topic. New PMs are easily overseen and others might have answered that question in the meantime.

What I ment… (#1)your code can’t be compiled straight away, because there are random characters at the beginning of some lines and no one would fix all of those.

(#2) Well, just that. Try adding the KeyListener somewere else and/or try using requestFocus(). You can request the focus for any component (eg a JPanel, a Canvas, JButton etc). For example: myCanvas.requestFocus();

(#3a) The headline is just pointless. It should indicate what the topic is about (this way you’ll attract more people who know what to do in that case). Eg a good headline would have been “KeyListener problems”.

(#3b) We have alot of different sub forums here. If you want to get help as fast as possible you should pick the right one. In this case the Newless Clubies board, because it’s a rather basic question wich doesn’t has anything to do with 2d/3d/sound/networking etc.