addKeyListener() doesn't work for JPanel
I am trying to make a game engine. I have made the Game class but the error resides in the KeyBoard class. Here I leave some code. Class:: Game package transfer2pc.co.cc.game.tileengine; import java.awt.Graphics; import java.util.HashMap; import javax.swing.JPanel; import transfer2pc.co.cc.game.tileengine.input.KeyBoard; public abstract class Game extends JPanel implements Runnable { /** * */ private static final long serialVersionUID = 640206679500196209L; HashMap<String, ?> maps = null; KeyBoard keyBoard = null; public Game(){ super(); keyBoard = new KeyBoard(this); setKeyBoard(keyBoard);