Currently, I have a JFrame that is an initial menu for settings etc. (currently doesn’t actually do anything) and I also have another Frame that uses fullscreen mode and is the actual game.
Everything works fine if I run the first menu and I just have it open the GameWindow, but when I create the GameWindow in the action listener for a button on the initial menu, the GameWindow then opens up, but the KeyListener and the MouseListener on the GameWindow do not work. Does anyone have a solution?
Does the GameWindow constructor start the game loop? If so you might be blocking the AWT event thread. Try constructing your GameWindow in a different thread.
Thread t = new Thread() {
public void run() {
new GameWindow(); // or whatever starts your game loop
}
};
t.start();
Kev
does it have focus?
yes, I am using requestFocus()
and
Thank you kev, that seemed to do the trick 
I had the same problem when I tried to add key/mouse listener on Frame for start menu and another one on JPanel for game loop. The one on JPanel didn’t work. I was told it dosen’t work that way, you only add one listener (to one component that is) and send input data to any other parts of program who need it. Also your component where listeners are added needs to have focus. For example if you put listeners in JFrame and for game loop you create JPanel and add it to JFrame, JPanel or his child components might steal the focus from JFrame. I don’t know if this is a good example, but you get the point.
Edit: huh… I’m glad you solved it, I was to slow writing the message 