I'm making a shape generator in java and every time you press add it's supposed to output a shape. I'm able to do that but I can only have it be one color using "rectangle.setBackground( java.awt.Color.magenta );" or any other color but only that one. I want to make a method that will pick from four different colors (magenta, orange, red, yellow) and set the color of the rectangle randomly every time a new rectangle is created. I keep seeing stuff about float but I can't get it to work so is there any way to do it without a float?
Aucun commentaire:
Enregistrer un commentaire