11import java .awt .Canvas ;
2+ import java .awt .Color ;
23import java .awt .Graphics ;
34import java .awt .Rectangle ;
4-
55import javax .swing .JFrame ;
66
7-
87public class Mickey extends Canvas {
98
10- // this is here to suppress a warning; you can read about it at
11- // http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html
12- static final long serialVersionUID = 1 ;
13-
149 public static void main (String [] args ) {
15- JFrame frame = new JFrame ("My Drawing " );
10+ JFrame frame = new JFrame ("Mickey Mouse " );
1611 Canvas canvas = new Mickey ();
1712 canvas .setSize (400 , 400 );
13+ canvas .setBackground (Color .white );
1814 frame .add (canvas );
1915 frame .pack ();
2016 frame .setVisible (true );
@@ -25,6 +21,10 @@ public void paint(Graphics g) {
2521 mickey (g , bb );
2622 }
2723
24+ public void boxOval (Graphics g , Rectangle bb ) {
25+ g .fillOval (bb .x , bb .y , bb .width , bb .height );
26+ }
27+
2828 public void mickey (Graphics g , Rectangle bb ) {
2929 boxOval (g , bb );
3030
@@ -39,7 +39,4 @@ public void mickey(Graphics g, Rectangle bb) {
3939 boxOval (g , half );
4040 }
4141
42- public void boxOval (Graphics g , Rectangle bb ) {
43- g .fillOval (bb .x , bb .y , bb .width , bb .height );
44- }
4542}
0 commit comments