..\CSC120\Java\lec05\src\LollipopTree.java |
1
2 import java.awt.Color;
3 import java.awt.Graphics;
4
5
6
7
8
9
10
11
12 @author
13
14 public class LollipopTree {
15
16 private Integer anchorX, anchorY;
17
18
19 public LollipopTree(Integer x, Integer y) {
20 anchorX = x;
21 anchorY = y;
22 }
23
24
25 public void draw(Graphics g) {
26 g.setColor(new Color(102, 51, 0));
27 g.fillRect(anchorX+60, anchorY+20, 30, 150);
28 g.setColor(Color.GREEN);
29 g.fillOval(anchorX, anchorY, 150, 80);
30 }
31
32 }
33