So, I’d like to create a keylistener inside my program that is applyable to all the classes in it (as when creating class as an object).
I don’t know how to do it with a key(or any other) listener.
Usually it would go: class blabla extends JPanel {blablabla;}, but it doesn’t work that way.
What is the way to go?
Consider creating a
EventHandlerclass that implementsKeyListenerinterface. Instatiate this class and pass toaddKeyListener()method: