|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Ele
Draws an elephant head at a user given x & y position with a user given width & height. The original aspect of the vector drawing is 5/7; height to width. The x, y, width, and height describe a rectangle just encompassing the elephant head.
| Constructor Summary | |
Ele()
Default constructor; Creates an Ele instance with starting x & y at 0,0; width=105 and height=75. |
|
Ele(int xp,
int yp,
int wd,
int ht)
Constructor; xp & yp are the starting x & y positions; wd is the width and ht is the height; These four arguments describe a rectangle just large enough to encompass the head. |
|
| Method Summary | |
void |
draw(java.awt.Graphics gr,
boolean fill)
Instance method; Draws the elephant head described by this instance of Ele in the graphics area described by Graphics gr. |
void |
eleinit(int xp,
int yp,
int wd,
int ht)
Instance method; This method is called by the constuctors to create and initialize all the polygons and polylines necessary to draw the elephant head. |
static int |
getAspHt(int width)
Class method; Static method returning the corresponding height, for the argument width, to keep the elephant head in aspect. |
static int |
getAspWth(int height)
Class method; Static method returning the corresponding width, for the argument height, to keep the elephant head in aspect. |
int |
height()
Instance method; returns the height. |
int |
startx()
Instance method; returns the x coordinate. |
int |
starty()
Instance method; returns the y coordinate. |
int |
width()
Instance method; returns the width. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Ele(int xp,
int yp,
int wd,
int ht)
int - xp; starting x coordinate.int - yp; starting y coordinate.int - wd; width of elephant head.int - ht; height of elephant head.public Ele()
| Method Detail |
public int startx()
public int starty()
public int width()
public int height()
public static int getAspWth(int height)
int width = 0, height = 70;
Ele e;
while(width<100)
{
width = Ele.getAspWth(height);
height += 1;
}
height -= 1;
e = new Ele(0,0,width,height);
Ele.getAspWth(5); will return 7.int - height; a height to test.public static int getAspHt(int width)
int width = 200, height = 0;
Ele e;
while(height<150)
{
height = Ele.getAspWth(width);
width += 1;
}
width -= 1;
e = new Ele(0,0,width,height);
Ele.getAspHt(7); will return 5.int - width; a width to test.
public void eleinit(int xp,
int yp,
int wd,
int ht)
public void draw(java.awt.Graphics gr,
boolean fill)
Graphics - gr; Graphics object of area to draw the elephant head.boolean - fill; If true a filled lightGray head is drawn; If false just the
outline is drawn.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||