When I try to test run the below code on Eclipse, the Java applet shows up, and only shows me a square. But it doesn't show the (rect2) rectangle
GRect Rect2 = new GRect (300, 75, 200, 100) ;
Rect2.setFilled (true) ;
Rect2.setColor (Color.RED) ;
add (Rect2) ;
or the (GLabel) "hello world".
GLabel Label = new GLabel ("Hello, world, 100, 75") ;
Label.setFont(new Font("Courier New", Font.ITALIC, 12));
Label.setColor (Color.RED); add (Label) ;
The whole code:
import acm.graphics.*;
import acm.program.* ;
import java.awt.* ;
public class Test extends GraphicsProgram {
private static final long serialVersionUID = 3365078119967111934L;
public void run () {
GLabel Label = new GLabel ("Hello, world, 100, 75") ;
Label.setFont(new Font("Courier New", Font.ITALIC, 12));
Label.setColor (Color.RED);
add (Label) ;
GRect Rect1 = new GRect (10, 10, 50, 50) ;
add(Rect1) ;
GRect Rect2 = new GRect (300, 75, 200, 100) ;
Rect2.setFilled (true) ;
Rect2.setColor (Color.RED) ;
add (Rect2) ;
}
}