|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.client.ui.AWT.widget.BackGroundDrawer
public class BackGroundDrawer
Background drawer is a class which keeps reference to a single Image and draws it according specified rules. For example, we can order to draw image by fully tiling it over all area, or tile it in a single row or column with desired alignment, or draw it just once. Alignment of drawing can be
| Field Summary | |
|---|---|
static int |
HALIGN_CENTER
Alignment to the center in case of Vertical or single tiling. |
static int |
HALIGN_EXACT
Shift right from left border of area by exact number of pixels. |
static int |
HALIGN_LEFT
Alignment to the left in case of Vertical or single tiling. |
static int |
HALIGN_RIGHT
Alignment to the right in case of Vertical or single tiling. |
static int |
NO_TILING
Single copy of image will be drawn. |
static int |
TILING_BOTH
Image will be tiled over all drawing area. |
static int |
TILING_HORIZONTAL
Image will be tiled into single row over drawing area. |
static int |
TILING_VERTICAL
Image will be tiled into single column over drawing area. |
static int |
VALIGN_BOTTOM
Alignment to the bottom in case of Horizontal or single tiling. |
static int |
VALIGN_CENTER
Alignment to the centre in case of Horizontal or single tiling. |
static int |
VALIGN_EXACT
Shift down from top border of area by exact number of pixels. |
static int |
VALIGN_TOP
Alignment to the top in case of Horizontal or single tiling. |
| Constructor Summary | |
|---|---|
BackGroundDrawer(java.awt.Image mainImage)
Tiling style is set to NO_TILING | VALIGN_CENTER | HALIGN_CENTER. |
|
BackGroundDrawer(java.awt.Image mainImage,
int behavior)
|
|
| Method Summary | |
|---|---|
void |
drawInto(java.awt.Graphics g,
int width,
int height)
Draws image into Graphics with custom tiling type and alignment. |
int |
getBehavior()
Returns integer describing behavior of BackgroundDrawer |
java.awt.Image |
getImage()
Gets image to draw by BackGroundDrawer |
void |
setHalign(int hAlign)
Sets horizontal align of tiling |
void |
setHalignExactAt(int x)
Sets exact horizontal alignment exactly at "x" pixels |
void |
setImage(java.awt.Image mainImage)
Sets image to draw by BackGroundDrawer |
void |
setTilingType(int type)
Sets type of tiling. |
void |
setValign(int vAlign)
Sets vertical align of tiling |
void |
setValignExactAt(int y)
Sets exact vertical alignment exactly at "y" pixels |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_TILING
public static final int TILING_VERTICAL
public static final int TILING_HORIZONTAL
public static final int TILING_BOTH
public static final int VALIGN_TOP
public static final int VALIGN_CENTER
public static final int VALIGN_BOTTOM
public static final int VALIGN_EXACT
public static final int HALIGN_LEFT
public static final int HALIGN_CENTER
public static final int HALIGN_RIGHT
public static final int HALIGN_EXACT
| Constructor Detail |
|---|
public BackGroundDrawer(java.awt.Image mainImage,
int behavior)
mainImage - image to draw by BackGroundDrawer.behavior - Integer value specifying way of tiling and alignment. For
exapmple:
BackGroundDrawer(myImage, BackGroundDrawer.TILING_VERTICAL | BackGroundDrawer.HALIGN_RIGHT);
public BackGroundDrawer(java.awt.Image mainImage)
mainImage - image to draw by BackGroundDrawer.| Method Detail |
|---|
public void setImage(java.awt.Image mainImage)
public java.awt.Image getImage()
public void setTilingType(int type)
type - Possible values: NO_TILING, TILING_BOTH, TILING_VERTICAL,
TILING_HORIZONTAL.public void setValign(int vAlign)
type - Must be VALIGN_TOP, VALIGN_CENTER, VALIGN_BOTTOMpublic void setHalign(int hAlign)
type - Must be HALIGN_LEFT, HALIGN_CENTER, HALIGN_RIGHTpublic void setValignExactAt(int y)
public void setHalignExactAt(int x)
public int getBehavior()
public void drawInto(java.awt.Graphics g,
int width,
int height)
g - Graphics to which draw to.width - Width of the drawing area.height - Height of the drawing area.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||