/***************************************************************************** * p1PartC.java * ***************************************************************************** * Name: Partner: * ID: ID: * Section: Section: * Date: * Project: *****************************************************************************/ import java.awt.*; public class p1PartC { public static void main(String[] args) { Drawing d = new Drawing(); // create object for drawing graphics d.setTitle("Drawing Window"); // set title of Drawing window d.setSize(400,200); // set size of Drawing window d.show(); // display/show window (starts off hidden) } } class Drawing extends Frame { public void paint(Graphics g) { // Drop below window title bar: g.translate(getInsets().left, getInsets().top); // Draw leftmost snowperson: g.setColor(Color.red); g.fillOval(40-10, 10, 20, 20); g.fillOval(40-20, 30, 40, 40); g.fillOval(40-30, 70, 60, 60); g.drawLine(20, 50, 20-20, 50-20); g.drawLine(60, 50, 60+20, 50-20); // Draw middle snowperson: g.setColor(Color.green); g.fillOval(80+40-10, 10, 20, 20); g.fillOval(80+40-20, 30, 40, 40); g.fillOval(80+40-30, 70, 60, 60); // no arms! // Draw rightmost snowperson: g.setColor(Color.blue); g.fillOval(2*80+40-10, 10, 20, 20); g.fillOval(2*80+40-20, 30, 40, 40); g.fillOval(2*80+40-30, 70, 60, 60); g.drawLine(2*80+20, 50, 2*80+20-20, 50+20); g.drawLine(2*80+60, 50, 2*80+60+20, 50+20); } }