Portrait - package lab10; import import import i import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
package lab10; p import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JPanel; i /** * A panel which shows a stick figure. */ public class Portrait extends JPanel { p /** Dimensions of body, all of which are in pixels. */ protected int headRadius; protected int neckHeight; protected int bodyHeight; protected int armSpan; protected int armRaise; protected int spreadEagleness; /** Dimensions of window in pixels. */ protected static final int SIZE = 100; /** Create a portrait with default body shape. */ public Portrait(double headPercent) { // Call sibling constructor. this(headPercent, 0.1, 0.2, 0.3, 0.1, 0.3); } /** Create a portrait with the specified body shape. */ public Portrait(double headPercent, double neckPercent, double bodyPercent, double armPercent, double armRaisePercent, double spreadEaglePercent) { setMinimumSize(new Dimension(SIZE, SIZE)); setPreferredSize(getMinimumSize()); setMaximumSize(getMinimumSize()); setHeadRadius(headPercent);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/20/2011 for the course COM SCI 227 taught by Professor Staff during the Spring '11 term at Iowa State.

Page1 / 3

Portrait - package lab10; import import import i import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online