I tried to make a JPanel that would display how many times you press each navigation key, but it is only displaying 4 zeros.
//In the keyPressed() method, I put the foll
Call repaint(); in keyPressed() method in the end.
repaint();
keyPressed()
Call count_keys.setFocusable(true); in main method just below its creation
count_keys.setFocusable(true);
main
Because JPanel is not focus able hence KeyListener is not working.
JPanel
KeyListener