1

I'm basically running a IF statement that in the condition checks if the array number[i] is equal to 18 and if so the color should be read but have had no luck with using html or setColor.

if (number[i].equals("18"))
            {
                number[i] = 
            }

What would I assign number[i] to be if the integer is 18?

Trials such as :

number[i].setColor(Color.red);
number[i] = number[i].setColor(Color.red)
number [i] = "<html> <font color=red> 18</font></html>";

Have all not worked

Should also point out 18 is stored as a string.

lecardo
  • 1,208
  • 4
  • 15
  • 37

1 Answers1

0

After reading some documentation, Here's what I'd try.

It seems like you want to make your button some sort of icon so to do that, the easiest way is to make a picture of what you want your icon to look like, and load that into an ImageIcon type

ImageIcon icon = new ImageIcon("images/redSquare.gif") 

after that, just pass the icon as a parameter to your JButton

if (number[i].equals("18"))
{
    printme[i] = new JButton(number[i], icon)
}