|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.lwuit.Component
com.sun.dtv.lwuit.Label
public class Label
Allows displaying labels and images with different alignment options, this class is a base class for several components allowing them to declare alignment/icon look in a similar way.
Field Summary |
---|
Fields inherited from class com.sun.dtv.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Fields inherited from interface com.sun.dtv.ui.ViewOnlyComponent |
---|
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, SCALE_ASPECT_PROOF, SCALE_NO, SCALE_NO_ASPECT_PROOF, STATE_DISABLED, STATE_ENABLED, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_TOP |
Fields inherited from interface com.sun.dtv.ui.Animated |
---|
ALTERNATING, LOOP, REPEATING |
Constructor Summary | |
---|---|
Label()
Construct an empty label. |
|
Label(Image icon)
Constructs a new label with the specified icon. |
|
Label(String text)
Constructs a new label with the specified string of text, left justified. |
Method Summary | |
---|---|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false. |
int |
getAlignment()
Returns the alignment of the Label. |
Image[] |
getAnimateContent(int state)
Returns the animated content for this component, depending on the current state. |
int |
getBaselineResizeBehavior()
Returns a constant indicating how the baseline varies with the size of the component. |
int |
getGap()
Returns the gap in pixels between the icon/text to the Label boundaries. |
Image |
getGraphicContent(int state)
Returns the graphical content for this component, depending on the current state. |
int |
getHorizontalAlignment()
Retrieve the horizontal alignment for any state-based content in this component. |
Image |
getIcon()
Returns the labels icon. |
int |
getInteractionState()
Return the current interaction state of the component. |
Matte |
getMatte()
Return the Matte currently associated with the
component implementing this interface. |
int |
getScalingMode()
Retrieve the scaling mode for this component. |
int |
getShiftText()
Simple getter to return how many pixels to shift the text inside the Label. |
String |
getText()
Returns the label text. |
String |
getTextContent(int state)
Returns the text content for this component, depending on the current state. |
TextLayoutManager |
getTextLayoutManager()
Gets the text layout manager that is currently in use for text layout in this component. |
int |
getTextPosition()
Returns The position of the text relative to the icon. |
int |
getVerticalAlignment()
Retrieve the vertical alignment for any state-based content in this component. |
boolean |
isDoubleBuffered()
Returns true if double buffering is available and activated. |
boolean |
isEndsWith3Points()
Simple getter. |
boolean |
isOpaque()
Returns true if the whole area of the Component (as returned by the com.sun.dtv.lwuit.Component#getBounds method, is opaque. |
boolean |
isTickerEnabled()
This method return true if the ticker is enabled on this Label. |
boolean |
isTickerRunning()
Returns true if the ticker is running. |
void |
paint(Graphics g)
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering. |
void |
processEvent(AWTEvent event)
Handle the specified AWTEvent. |
void |
setAlignment(int align)
Convenience method, similar to #setHorizontalAlignment |
void |
setAnimateContent(Image[] images,
int state)
Assigns an array of graphical content to be used for animation to this component which is state-dependent. |
void |
setEndsWith3Points(boolean endsWith3Points)
If the Label text is too long fit the text to the widget and add "..." |
void |
setGap(int gap)
Set the gap in pixels between the icon/text to the Label boundaries. |
void |
setGraphicContent(Image image,
int state)
Assigns graphical content to this component which is state-dependent. |
void |
setHorizontalAlignment(int alignment)
Set the horizontal alignment for any state-based content in this component. |
void |
setIcon(Image icon)
Sets the Label icon. |
void |
setInteractionState(int state)
Set the current state of the component with respect to interaction. |
void |
setMatte(Matte matte)
Adds an Matte to the component implementing this
interface in order to enable matte compositing. |
void |
setScalingMode(int scaling)
Set the scaling mode for this component. |
void |
setShiftText(int shiftText)
This method shifts the text from it's position in pixels. |
void |
setText(String text)
Sets the Label text. |
void |
setTextContent(String text,
int state)
Assigns text content to this component which is state-dependent. |
void |
setTextLayoutManager(TextLayoutManager manager)
Sets the text layout manager that should be used for text layout in this component. |
void |
setTextPosition(int textPosition)
Sets the position of the text relative to the icon if exists. |
void |
setTickerEnabled(boolean tickerEnabled)
Sets the Label to allow ticking of the text. |
void |
setVerticalAlignment(int valign)
Set the vertical alignment for any state-based content in this component. |
void |
startTicker(long delay,
boolean rightToLeft)
This method will start the text ticker. |
void |
stopTicker()
Stops the text ticker. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Label(String text)
text
- the string that the label presents.public Label()
public Label(Image icon)
icon
- the image that the label presents.Method Detail |
---|
public int getBaselineResizeBehavior()
Component
getBaselineResizeBehavior
in class Component
public void setText(String text)
text
- the string that the label presents.getText()
public String getText()
setText(java.lang.String)
public void setIcon(Image icon)
icon
- the image that the label presents.getIcon()
public Image getIcon()
setIcon(com.sun.dtv.lwuit.Image)
public void setAlignment(int align)
public void setVerticalAlignment(int valign)
ViewOnlyComponent
setVerticalAlignment
in interface ViewOnlyComponent
valign
- the vertical alignment mode, one of
ViewOnlyComponent.VERTICAL_ALIGN_TOP
,
ViewOnlyComponent.VERTICAL_ALIGN_CENTER
,
ViewOnlyComponent.VERTICAL_ALIGN_BOTTOM
or
ViewOnlyComponent.VERTICAL_ALIGN_JUSTIFIED
.ViewOnlyComponent.getVerticalAlignment()
public int getVerticalAlignment()
ViewOnlyComponent
getVerticalAlignment
in interface ViewOnlyComponent
ViewOnlyComponent.VERTICAL_ALIGN_TOP
,
ViewOnlyComponent.VERTICAL_ALIGN_CENTER
,
ViewOnlyComponent.VERTICAL_ALIGN_BOTTOM
or
ViewOnlyComponent.VERTICAL_ALIGN_JUSTIFIED
.ViewOnlyComponent.setVerticalAlignment(int)
public int getAlignment()
ViewOnlyComponent.HORIZONTAL_ALIGN_LEFT
,
ViewOnlyComponent.HORIZONTAL_ALIGN_CENTER
,
ViewOnlyComponent.HORIZONTAL_ALIGN_RIGHT
or
ViewOnlyComponent.HORIZONTAL_ALIGN_JUSTIFIED
.setAlignment(int)
public void setTextPosition(int textPosition)
textPosition
- alignment value (LEFT, RIGHT, BOTTOM or TOP)getTextPosition()
,
Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public int getTextPosition()
setTextPosition(int)
,
Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public void setGap(int gap)
gap
- the gap in pixelsgetGap()
public int getGap()
setGap(int)
public void paint(Graphics g)
Component
paint
in interface Animation
paint
in interface ViewOnlyComponent
paint
in class Component
g
- the component graphicspublic int getShiftText()
setShiftText(int)
public void setShiftText(int shiftText)
shiftText
- The number of pixels to move the textgetShiftText()
public void startTicker(long delay, boolean rightToLeft)
delay
- the delay in milliseconds between animation intervalsrightToLeft
- if true move the text to the leftpublic void stopTicker()
public boolean isTickerRunning()
public void setTickerEnabled(boolean tickerEnabled)
tickerEnabled
- indicate whether ticker is enabledpublic boolean isTickerEnabled()
public void setEndsWith3Points(boolean endsWith3Points)
endsWith3Points
- true if text should add "..." at the endpublic boolean isEndsWith3Points()
public boolean animate()
Animation
animate
in interface Animation
animate
in class Component
public void setTextContent(String text, int state) throws IllegalArgumentException
ViewOnlyComponent
setTextContent
in interface ViewOnlyComponent
text
- the text content, or null (removes text content which had
been assigned before)state
- the state of the component for which this content should be
displayed, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.getTextContent(int)
public void setGraphicContent(Image image, int state) throws IllegalArgumentException
ViewOnlyComponent
setGraphicContent
in interface ViewOnlyComponent
image
- the graphical content, or null (removes graphical content
which had been assigned before)state
- the state of the component for which this content should be
displayed, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.getGraphicContent(int)
public void setAnimateContent(Image[] images, int state) throws IllegalArgumentException
ViewOnlyComponent
setAnimateContent
in interface ViewOnlyComponent
images
- the graphical content array, or null (removes any graphical
content which had been assigned before)state
- the state of the component for which this content should be
displayed, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.getAnimateContent(int)
public String getTextContent(int state) throws IllegalArgumentException
ViewOnlyComponent
getTextContent
in interface ViewOnlyComponent
state
- the state of the component for which this content is to
be retrieved, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.setTextContent(java.lang.String, int)
public Image getGraphicContent(int state) throws IllegalArgumentException
ViewOnlyComponent
getGraphicContent
in interface ViewOnlyComponent
state
- the state of the component for which this content is to
be retrieved, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.setGraphicContent(com.sun.dtv.lwuit.Image, int)
public Image[] getAnimateContent(int state) throws IllegalArgumentException
ViewOnlyComponent
getAnimateContent
in interface ViewOnlyComponent
state
- the state of the component for which this content is to
be retrieved, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.setAnimateContent(com.sun.dtv.lwuit.Image[], int)
public void setInteractionState(int state) throws IllegalArgumentException
ViewOnlyComponent
setInteractionState
in interface ViewOnlyComponent
state
- the interaction state for this content, one of STATE_ENABLED
or STATE_DISABLED
IllegalArgumentException
- if the state parameter does not
represent a stateViewOnlyComponent.getInteractionState()
public int getInteractionState()
ViewOnlyComponent
getInteractionState
in interface ViewOnlyComponent
ViewOnlyComponent.setInteractionState(int)
public void setTextLayoutManager(TextLayoutManager manager)
ViewOnlyComponent
setTextLayoutManager
in interface ViewOnlyComponent
manager
- the TextLayoutManager
ViewOnlyComponent.getTextLayoutManager()
public TextLayoutManager getTextLayoutManager()
ViewOnlyComponent
getTextLayoutManager
in interface ViewOnlyComponent
TextLayoutManager
ViewOnlyComponent.setTextLayoutManager(com.sun.dtv.ui.TextLayoutManager)
public void setHorizontalAlignment(int alignment)
ViewOnlyComponent
setHorizontalAlignment
in interface ViewOnlyComponent
alignment
- the horizontal alignment mode, one of
ViewOnlyComponent.HORIZONTAL_ALIGN_LEFT
,
ViewOnlyComponent.HORIZONTAL_ALIGN_CENTER
,
ViewOnlyComponent.HORIZONTAL_ALIGN_RIGHT
or
ViewOnlyComponent.HORIZONTAL_ALIGN_JUSTIFIED
.ViewOnlyComponent.getHorizontalAlignment()
public int getHorizontalAlignment()
ViewOnlyComponent
getHorizontalAlignment
in interface ViewOnlyComponent
ViewOnlyComponent.HORIZONTAL_ALIGN_LEFT
,
ViewOnlyComponent.HORIZONTAL_ALIGN_CENTER
,
ViewOnlyComponent.HORIZONTAL_ALIGN_RIGHT
or
ViewOnlyComponent.HORIZONTAL_ALIGN_JUSTIFIED
.ViewOnlyComponent.setHorizontalAlignment(int)
public void setScalingMode(int scaling)
ViewOnlyComponent
setScalingMode
in interface ViewOnlyComponent
scaling
- the scaling mode, one of
ViewOnlyComponent.SCALE_NO
,
ViewOnlyComponent.SCALE_NO_ASPECT_PROOF
or
ViewOnlyComponent.SCALE_ASPECT_PROOF
.ViewOnlyComponent.getScalingMode()
public int getScalingMode()
ViewOnlyComponent
getScalingMode
in interface ViewOnlyComponent
ViewOnlyComponent.SCALE_NO
,
ViewOnlyComponent.SCALE_NO_ASPECT_PROOF
or
ViewOnlyComponent.SCALE_ASPECT_PROOF
.ViewOnlyComponent.setScalingMode(int)
public boolean isDoubleBuffered()
ViewOnlyComponent
isDoubleBuffered
in interface ViewOnlyComponent
true
if double buffering is available and activated,
and false otherwisepublic boolean isOpaque()
ViewOnlyComponent
com.sun.dtv.lwuit.Component#getBounds
method, is opaque.
isOpaque
in interface ViewOnlyComponent
true
if all the pixels within the area
defined by the com.sun.dtv.lwuit.Component#getBounds
method
are opaque, i.e. all pixels are painted in an opaque color,
false
otherwise.public void processEvent(AWTEvent event)
ViewOnlyComponent
processEvent
in interface ViewOnlyComponent
event
- a java.awt.AWTEvent to handle.public void setMatte(Matte matte) throws MatteException
MatteEnabled
Matte
to the component implementing this
interface in order to enable matte compositing. If there is already a
Matte assigned to the component, and this Matte is animated, it has to be
stopped before any call to this method.
setMatte
in interface MatteEnabled
matte
- the Matte
to be assigned to the
component. At any point of time there can only be one matte associated to
the component, that's way any matte that has been associated before will
be overriden by a call to this method.
The Matte parameter can also be null, in this case there is no matte
associated with the component after the call, even if there had been one
before.
MatteException
- if the Matte
has an
unsupported type, the platform does not support mattes at all, or an
animated matte is associated with the component and is still runningMatteEnabled.getMatte()
public Matte getMatte()
MatteEnabled
Matte
currently associated with the
component implementing this interface.
getMatte
in interface MatteEnabled
Matte
currently associated with the
component or null if there is noneMatteEnabled.setMatte(com.sun.dtv.ui.Matte)
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |