ASSIGNMENT: The student will create the applet to the left. This exercise gives the student practice using the drawLine method.
HINT: public void drawDiamond(Graphics g, int x, int y, int size){ g.drawLine(x,y,x-size,y+size); g.drawLine(x,y,x+size,y+size); g.drawLine(x+size,y+size,x,y+2*size); g.drawLine(x-size,y+size,x,y+2*size); }It can be called from within the paint method like this: drawDiamond(g, 100, 10, 20); |
x |