Doughnut - white circle
in middle
g.fillOval(10,10, 100,100);
g.setColor(Color.white);
g.fillOval(30,30,60,60);
|
 |
Arc - doughnut with a rectangle
cover
g.fillOval(10,10, 100,100);
g.setColor(Color.white);
g.fillOval(30,30,60,60);
g.fillRect(10,60,100,50);
|
 |
Cup - build up pieces
import java.awt.*;
import java.applet.*;
public class cup extends Applet
{
public void paint (Graphics g)
{//handle, pull out middle
g.fillOval(60,10,40,40);
g.setColor(Color.white);
g.fillOval(70,20,20,20);
//curved corner
g.setColor(Color.black);
g.fillOval(30,30,20,20);
//cup, blocking in space
g.fillRect(30,10,50,30);
g.fillRect(40,30,40,20);
//saucer
g.fillRect(10,60,90,10);
}
}
|
 |