I am trying to create a grid with randomly colored buttons. I was able to create the grid, add buttons to it and even create a random color- only issue is the color is only showing up on the edges of the buttons. I even tried using the button.setForeground(color) as a possible solution but it did not work. I want the entire button to be colored with my randomly generated color. How can I do so?
for (int i=0; i < 4; i++){
for (int j=0; j < 3; j++){
Color color = randomColorGenerator();
buttons[i][j] = new JButton();
buttons[i][j].setBackground(color);
buttons[i][j].setOpaque(true);
jp.add(buttons[i][j]);
}
}