Reputation: 1
I have been struggling to get acm graphics to display in eclipse. When I simply run the below code, the applet starts but nothing is displayed. The class is in default package in the source directory. Thanks in advance for any feedback.
import acm.graphics.*;
import acm.program.GraphicsProgram;
import java.awt.Color;
public class run extends GraphicsProgram{
public void oval() {
GOval ov = new GOval(50,50,50,50);
ov.setFilled(true);
ov.setColor(java.awt.Color.green);
add(ov);
}
}
Upvotes: 0
Views: 301
Reputation: 159784
Use the GraphicsProgram
init
method which will be called automatically
public void init() {
GOval ov = new GOval(50,50,50,50);
...
}
Upvotes: 0