If you want to store which color it is after the user clicks the button as the color name, you could do this... at the beginning of the code declare a string (String colorName) and then when you have the source of the event, instead of saying currentnumber = 1, put colorName = "red":
if (e.getSource()==b1) colorName = "red";
When you need to find out what color is chosen later on, you can use the compareTo function, like this:
if (colorName.compareTo("red") == 0) {
//The color is red
}
else if (colorName.compareTo("blue") {
//the color is blue
}
etc.
Hope this helps,
- Master Of Souls
"Weeks of coding can save hours of planning."
Bookmarks