-2

I am not sure why this is showing an error on greenfoot.It says this is an incompatible type. How to fix it , as shown here

Mustapha Belmokhtar
  • 1,231
  • 8
  • 21

1 Answers1

0

In last version of Greenfoot there is a special class Color. It interferes with awt class Color with the same name. Use the Greenfoot's class Color in your code. For example:

    public MyWorld()
    {    
        super(600, 400, 1); 
        GreenfootImage bgr = getBackground();
        int r = (int)(0.8f * 255);
        int g = (int)(0.95f * 255);
        int b = (int)(1.0f * 255);
        int a = (int)(1.0f * 255);
        Color bgrColor = new Color(r, g, b, a);
        bgr.setColor(bgrColor);
        bgr.fill();
    }