The ellipse is not painted probably because the bounds of SimpleEllipseNode
are empty. Add these lines to initialize()
:
aNode.setPaint(Color.RED);
aNode.setBounds(0, 0, 100, 100);
And it should paint a red ellipse. There is an NPE in setBounds()
since the ellipse
is not initialized yet. This can be fixed by adding getEllipse();
as a first line in setBounds()
.
Not sure what is the reason behind overriding paint()
and setBounds()
, as usually you can get away easily by using compositional nodes. For example:
import java.awt.Color;
import edu.umd.cs.piccolo.nodes.PPath;
import edu.umd.cs.piccolox.PFrame;
public class SimpleEllipseNode {
public static void main(final String[] args) {
PFrame frame = new PFrame() {
@Override
public void initialize() {
final PPath circle = PPath.createEllipse(0, 0, 100, 100);
circle.setPaint(Color.RED);
getCanvas().getLayer().addChild(circle);
}
};
}
}