public void generateTable(int n) {
        table = new JTable(n, n);
        scrollPane = new JScrollPane(table);

        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
        renderer.setHorizontalAlignment(JLabel.CENTER);
        for (int i = 0; i < table.getColumnCount(); i++) {
            table.setDefaultRenderer(table.getColumnClass(i), renderer);
        }

        table.setGridColor(Color.black);
        table.setRowHeight(window.getWidth() / n);
        table.setRowSelectionAllowed(false);
        table.setColumnSelectionAllowed(false);
        table.setFont(new Font("Serif", Font.BOLD, window.getWidth() / n));

        table.updateUI();

        //egerkezelés
        table.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                int row = table.rowAtPoint(evt.getPoint());
                int col = table.columnAtPoint(evt.getPoint());
                if (row >= 0 && col >= 0 && !jatek.isGameWon()) {
                    Token t;
                    if (jatek.getElozoSiker()) {
                        t = jatek.getNextPlayer().getToken();
                    } else {
                        t = jatek.getPrevPlayer().getToken();
                    }
                    if (jatek.addToken(row, col, t)) {
                        table.setValueAt(t.getType(), row, col);
                    }
                }
                if (jatek.isGameWon()) {
                    table.setEnabled(false);
                }
                window.validate();
                window.repaint();
            }
        });
        window.add(scrollPane, BorderLayout.CENTER);
        window.repaint();
    }