|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.droplets.api.Component | +--com.droplets.api.Label
A Label GUI component. A label is simply a freestanding string that appears directly on a panel.
Labels support drag and drop. You need to pass the Component you want to accept
drops from to the addAcceptDrop
function. You then need to add a DropListener
via a call to addDropListener
. When a drop occurs we will generate a DropEvent
.
This DropEvent
will be handled by DropListener
class you created and added above.
Aside from the standard set of Component properties and those defined in the
DragAndDrop
interface, Label defines several of its own:
width
- the preferred width of the label in pixels
alignment
- the alignment of the text within the
label. May be ALIGN_LEFT, ALIGN_CENTER, or ALIGN_RIGHT.
shadow
- a boolean which controls whether the text
will be displayed in shadowed stylemargin
- the number of pixels to leave in between the
text and the sides of the label component. Has no effect if the
alignment is set to ALIGN_CENTER
.
Field Summary | |
static java.lang.String |
ALIGN_CENTER
Constant used by the alignment property to indicate
centered alignment |
static java.lang.String |
ALIGN_LEFT
Constant used by the alignment property to indicate left
alignment |
static java.lang.String |
ALIGN_RIGHT
Constant used by the alignment property to indicate right
alignment |
Fields inherited from class com.droplets.api.Component |
ANCHOR_CENTER, ANCHOR_EAST, ANCHOR_NORTH, ANCHOR_NORTHEAST, ANCHOR_NORTHWEST, ANCHOR_SOUTH, ANCHOR_SOUTHEAST, ANCHOR_SOUTHWEST, ANCHOR_WEST, FILL_BOTH, FILL_HORIZONTAL, FILL_NONE, FILL_VERTICAL |
Constructor Summary | |
Label(LayoutPlacement p,
java.lang.String text,
Window window)
Constructs a new Label. |
Method Summary | |
protected void |
action(java.lang.String action,
java.lang.String args)
Called by the server when the user has performed an action on this component. |
void |
addAcceptDrop(Component c)
Add a valid target for us to accept drop messages from. |
void |
addDropListener(DropListener l)
Add a DropListener that will be called when a drop occurs
on this component. |
java.lang.String |
getAlignment()
Gets the text alignment. |
Color |
getDragOverBgColor()
Gets the background color of the row that the mouse is being dragged over. |
Color |
getDragOverFgColor()
Gets the foreground color of the row that the mouse is being dragged over. |
boolean |
getIsMoveHandle()
if true, the label will move the parent window if it is dragged. |
int |
getMargin()
Gets the number of pixels to leave in between the text and the sides of this label. |
boolean |
getShadow()
Determines whether shadowing of the text is on or off. |
int |
getWidth()
Gets the preferred width. |
protected boolean |
isFocusTraversableDefault()
See Component.isFocusTraversableDefault() . |
void |
removeAcceptDrop(Component c)
Stop accepting drop messages from the specified target. |
void |
removeDropListener(DropListener l)
Remove a DropListener that was added previously. |
void |
setAlignment(java.lang.String value)
Specifies whether text should be left-aligned, right-aligned, or centered. |
void |
setAlignment(java.lang.String value,
java.lang.String skin)
Specifies whether text should be left-aligned, right-aligned, or centered. |
void |
setDragOverBgColor(Color c)
Sets the background color of the row that the mouse is being dragged over. |
void |
setDragOverBgColor(Color c,
java.lang.String skin)
Sets the background color of the row that the mouse is being dragged over. |
void |
setDragOverFgColor(Color c)
Sets the foreground color of the row that the mouse is being dragged over. |
void |
setDragOverFgColor(Color c,
java.lang.String skin)
Sets the foreground color of the row that the mouse is being dragged over. |
void |
setIsMoveHandle(boolean value)
if true, the label will move the parent window if it is dragged. |
void |
setIsMoveHandle(boolean value,
java.lang.String skin)
if true, the label will move the parent window if it is dragged. |
void |
setMargin(int value)
Sets the number of pixels to leave in between the text and the sides of this label. |
void |
setMargin(int value,
java.lang.String skin)
Sets the number of pixels to leave in between the text and the sides of this label. |
void |
setShadow(boolean value)
Turns shadowing of the text on or off. |
void |
setShadow(boolean value,
java.lang.String skin)
Turns shadowing of the text on or off. |
void |
setWidth(int value)
Sets the preferred width. |
void |
setWidth(int value,
java.lang.String skin)
Sets the preferred width. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ALIGN_LEFT
alignment
property to indicate left
alignmentpublic static final java.lang.String ALIGN_CENTER
alignment
property to indicate
centered alignmentpublic static final java.lang.String ALIGN_RIGHT
alignment
property to indicate right
alignmentConstructor Detail |
public Label(LayoutPlacement p, java.lang.String text, Window window)
p
- specifies how this component should be laid out in the
enclosing panel (see LayoutPlacement
)text
- the initial text (considered the label's
value, so it will be returned by Component.getValue()
window
- the window in which this component will be placedMethod Detail |
public void setWidth(int value, java.lang.String skin)
value
- width in pixelspublic void setWidth(int value)
value
- width in pixelspublic int getWidth()
public void setAlignment(java.lang.String value, java.lang.String skin)
value
- the desired alignment constant. Must be one of
Label.ALIGN_CENTER, Label.ALIGN_LEFT, or
Label.ALIGN_RIGHT
.skin
- skin name to use for this attributepublic void setAlignment(java.lang.String value)
value
- the desired alignment constant. Must be one of
Label.ALIGN_CENTER, Label.ALIGN_LEFT, or
Label.ALIGN_RIGHT
.public java.lang.String getAlignment()
Label.ALIGN_CENTER, Label.ALIGN_LEFT, or
Label.ALIGN_RIGHT
public void setShadow(boolean value, java.lang.String skin)
value
- true to turn shadowing on, false to turn it offskin
- skin name to use for this attributepublic void setShadow(boolean value)
value
- true to turn shadowing on, false to turn it offpublic boolean getShadow()
public void setMargin(int value, java.lang.String skin)
ALIGN_CENTER
.value
- the desired marginskin
- skin name to use for this attributepublic void setMargin(int value)
ALIGN_CENTER
.value
- the desired marginpublic int getMargin()
ALIGN_CENTER
.protected void action(java.lang.String action, java.lang.String args)
Component
action
in class Component
com.droplets.api.Component
action
- Identifies the type of action that occurredargs
- Action-specific arguments (extra information)public boolean getIsMoveHandle()
public void setIsMoveHandle(boolean value, java.lang.String skin)
value
- true if the label should be a move handle.skin
- the skin name to use for this attributepublic void setIsMoveHandle(boolean value)
value
- true if the label should be a move handle.public Color getDragOverBgColor()
public Color getDragOverFgColor()
public void setDragOverBgColor(Color c, java.lang.String skin)
c
- Desired value of this attribute.skin
- The name to use for this attribute in the skin files.public void setDragOverBgColor(Color c)
c
- Desired value of this attribute.public void setDragOverFgColor(Color c, java.lang.String skin)
c
- Desired value of this attribute.skin
- The name to use for this attribute in the skin files.public void setDragOverFgColor(Color c)
c
- Desired value of this attribute.public void addDropListener(DropListener l)
DropListener
that will be called when a drop occurs
on this component.l
- The listener to be informed when a drop occurs.public void removeDropListener(DropListener l)
DropListener
that was added previously.l
- The listener of interest.public void addAcceptDrop(Component c)
c
- The component to accept drop messages from.public void removeAcceptDrop(Component c)
c
- The component that no longer will send drop messages to us.protected boolean isFocusTraversableDefault()
Component.isFocusTraversableDefault()
.isFocusTraversableDefault
in class Component
com.droplets.api.Component
Component.setFocusTraversable(boolean)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |