0
I created a GUI for a Board of a game with an 8x8 Gridlayout. In this Grid I need to have a mouse Listener in each of the containers. How do I get that? I’ve tried many ways and I’m not getting it.
Code:
public static void createAndShowGUI() {
GridLayout gl_Board = new GridLayout(0, 1, 5, 5);
board = new Board();
JPanel Board = new JPanel(gl_Board);
Board.add(board);
board.setLayout(new GridLayout(8, 8, 2, 2));
Board.setBounds(10, 25, 708, 423);
frame.getContentPane().add(Board);
Don’t forget to add the knob to the panel
– André