I'm creating an AbstractColorChooserPanel for recent colours (in a 4 * 4 grid) and while setting the background colour for the recent colours it only appears as a border to the button instead of filling it.
According to this the code below should work:
button.setBackground(Color.RED);
button.setOpaque(true);
Ive also tried adding
button.setBorderPainted(false);
but all that displays is a grey (standard colour) button with a red border. I have tried putting the code on a button outside the JColorChooser and received the same effect. example
How do I make it so the entire button is filled with the red colour instead of just the border?
EDIT: The problem turned out to be the UIManager (default system look and feel) To solve this I modified the code used in this solution.