I am making Tetris in Java. I have the Grid as its own class (extends JPanel) a menu bar (also extends JPanel) and a class for the main game window (extends JFrame). I created instances of the Grid and the menu bar inside the main game window class and added them to a wrapper JPanel. I put the keyListener (which calls methods from the instance of the Grid) in the main game window class, but it doesn't work. Where should I implement the keyListener if I want it to change things in the Grid?

First show some.
If it is too big, then you need to implemented somewhere where when the method is called you can have access to the elements you want to change.
So I assume If you want to change the grid have the keylistener where the grid is created.
Or if you have it in a separate class, you can have that class which probably implements the KeyListener take as parameter that grid

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.