user3072046
user3072046

Reputation: 1

Trouble getting acm graphics to display using eclipse

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

Answers (1)

Reimeus
Reimeus

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

Related Questions