How can I set the text color of my label class to be white? I already imported java.awt.Color package but I don't know how to use it very well.
public Label(String text) { GreenfootImage img = new GreenfootImage (100,30); img.drawString(text ,2 , 20); setImage(img); }
img.setColor(Color.white); //Or whatever other color you want.
//Changing image when clicked if (Greenfoot.mouseClicked(this)) setImage(newImage); //Dragging (I know you'll want this one) if (Greenfoot.mouseDragged(this)) { MouseInfo mi = Greenfoot.getMouseInfo(); setLocation(mi.getX(), mi.getY()); }