[Solved] How do I get rid of the gaps between the tiles?


You need to add the JButton to mainPanel instead of panel.

Some duplicated lines and not necessary settings removed

for (int i = 0; i < 64; i++) {
    label[i] = new JButton();
    label[i].setBorderPainted(false);
    mainPanel.add(label[i]);
    label[i].setIcon(new ImageIcon(getClass()
        .getResource("/org/me/images/O.png")));
    label[i].setPreferredSize(new Dimension(50, 50));
    label[i].setToolTipText("label" + i);
}

0

solved How do I get rid of the gaps between the tiles?