What's the method that allows you to use the JFrame
without clicking on it first? I have a game, but in order to move with WASD I first need to click on the frame when the application is run. Isn't there a method that makes it so you can use it straight away without clicking first?
I have this:
Game game = new Game();
game.frame.setResizable(false);
game.frame.setTitle(Game.title);
game.frame.add(game);
game.frame.pack();
game.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
game.frame.setLocationRelativeTo(null);
game.frame.setVisible(true);
Where should I put game.frame.requestFocus();
?