I ran the following code on eclipse.
import acm.graphics.*;
import acm.program.*;
import java.awt.*;
public class picture extends GraphicsProgram {
public void run() {
GRect sqr = new GRect(20, 20, 50, 50);
sqr.setColor(Color.BLUE);
add(sqr);
sqr.setLocation(0, 0);
sqr.setColor(Color.RED);
sqr.setFilled(true);
}
}
Since the add(sqr) went before I set the location, fill, and before I set the color to red, shouldn't the result be an unfilled blue square? Yet for some reason a red square shows up.