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);
setNeckHeight(neckPercent);
setBodyHeight(bodyPercent);
setArmSpan(armPercent);
setArmRaise(armRaisePercent);
This
preview
has intentionally blurred sections.
Sign up to view the full version.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Spring '11
- Staff
- Human height, International Phonetic Alphabet, public void, Spread Toolkit, param percent
-
Click to edit the document details