|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
capella.GUI.LabelImage
public class LabelImage
A LabelImage object is a lightweight component for placing
an image in a container.
For example the code:
setLayout(new BorderLayout());
add("Center",new LabelImage(INSERT_AN_URL_HERE,LabelImage.LEFT);
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
BOTTOM
Indicates that the label should be placed at the bottom. |
static int |
CENTER
Indicates that the label should be centered. |
static int |
LEFT
Indicates that the label should be placed on the left. |
static int |
RIGHT
Indicates that the label should be placed on the right. |
static int |
TOP
Indicates that the label should be placed on top. |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
LabelImage(String path)
Constructs a centered label. |
|
LabelImage(String path,
int alignment)
Constructs a label justified as desired. |
|
LabelImage(URL url)
Constructs a centered label. |
|
LabelImage(URL url,
int alignment)
Constructs a label justified as desired. |
|
| Method Summary | |
|---|---|
int |
getAlignment()
Gets the current alignment for this label. |
Image |
getImage()
Gets the current image. |
Dimension |
getPreferredSize()
Gets the preferred size for this label. |
void |
paint(Graphics g)
Paints this label. |
void |
setAlignment(int alignment)
Sets the alignment for this label. |
void |
setImage(Image image)
Sets the image for this label. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int CENTER
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
| Constructor Detail |
|---|
public LabelImage(String path)
path - the path of a local image-file.
public LabelImage(String path,
int alignment)
Possible values for alignment are LabelImage.CENTER,
LabelImage.LEFT, LabelImage.RIGHT,
LabelImage.TOP and LabelImage.BOTTOM.
path - the path of a local image-file.alignment - the alignment value.public LabelImage(URL url)
url - the URL of an image.
public LabelImage(URL url,
int alignment)
Possible values for alignment are LabelImage.CENTER,
LabelImage.LEFT, LabelImage.RIGHT,
LabelImage.TOP and LabelImage.BOTTOM.
url - the URL of an image.alignment - the alignment value.| Method Detail |
|---|
public Image getImage()
setImage(java.awt.Image)public void setImage(Image image)
image - the image to use.
IllegalArgumentException - if an null object is given.getImage()public int getAlignment()
Possible values for alignment are LabelImage.CENTER,
LabelImage.LEFT, LabelImage.RIGHT,
LabelImage.TOP and LabelImage.BOTTOM.
setAlignment(int)public void setAlignment(int alignment)
Possible values for alignment are LabelImage.CENTER,
LabelImage.LEFT, LabelImage.RIGHT,
LabelImage.TOP and LabelImage.BOTTOM.
alignment - the desired alignment.
IllegalArgumentException - if an illegal value for
alignment is given.getAlignment()public void paint(Graphics g)
paint in class Componentg - the graphics context to use for painting.public Dimension getPreferredSize()
getPreferredSize in class ComponentDimension
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||