|
Java DTV API 1.0 12-Dec-2008 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.lwuit.Component
com.sun.dtv.ui.MatteEnabledComponent
com.sun.dtv.ui.ViewOnlyComponent
com.sun.lwuit.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.ui.ViewOnlyComponent |
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, SCALE_ASPECT_PROOF, SCALE_NO, SCALE_NO_ASPECT_PROOF, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_TOP |
Fields inherited from class com.sun.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.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. |
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content. |
int |
getAlignment()
Returns the alignment of the Label. |
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 |
getIcon()
Returns the labels icon. |
int |
getShiftText()
Simple getter to return how many pixels to shift the text inside the Label. |
String |
getText()
Returns the label text. |
int |
getTextPosition()
Returns The position of the text relative to the icon. |
protected String |
getUIID()
Unique identifier for a component, must be overriden for a component so a style can be applied to the component. |
int |
getVerticalAlignment()
Returns the vertical alignment of the Label, this will only work when the icon is in the side of the text and not above or below it. |
boolean |
isEndsWith3Points()
Simple getter. |
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)
Method to paint the component. |
protected String |
paramString()
Returns a string representing the state of this component. |
void |
setAlignment(int align)
Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHT. |
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 |
setIcon(Image icon)
Sets the Label icon. |
void |
setShiftText(int shiftText)
This method shifts the text from it's position in pixels. |
void |
setText(String text)
Sets the Label text. |
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)
Sets the vertical alignment of the Label to one of: CENTER, TOP, BOTTOM. |
void |
startTicker(long delay,
boolean rightToLeft)
This method will start the text ticker. |
void |
stopTicker()
Stops the text ticker. |
Methods inherited from class com.sun.dtv.ui.ViewOnlyComponent |
getAnimateContent, getGraphicContent, getHorizontalAlignment, getInteractionState, getScalingMode, getTextContent, getTextLayoutManager, isOpaque, setAnimateContent, setGraphicContent, setHorizontalAlignment, setInteractionState, setScalingMode, setTextContent, setTextLayoutManager |
Methods inherited from class com.sun.dtv.ui.MatteEnabledComponent |
getMatte, isDoubleBuffered, processEvent, setMatte |
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.lwuit.Image)
public void setAlignment(int align)
align
- alignment valuegetAlignment()
,
Component.CENTER
,
Component.LEFT
,
Component.RIGHT
public void setVerticalAlignment(int valign)
setVerticalAlignment
in class ViewOnlyComponent
valign
- alignment valuegetVerticalAlignment()
,
Component.CENTER
,
Component.TOP
,
Component.BOTTOM
public int getVerticalAlignment()
getVerticalAlignment
in class ViewOnlyComponent
setVerticalAlignment(int)
,
Component.CENTER
,
Component.TOP
,
Component.BOTTOM
public int getAlignment()
setAlignment(int)
,
Component.CENTER
,
Component.LEFT
,
Component.RIGHT
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)
protected String getUIID()
Component
getUIID
in class Component
protected String paramString()
Component
null
.
paramString
in class Component
public void paint(Graphics g)
ViewOnlyComponent
paint
in interface Animated
paint
in class ViewOnlyComponent
g
- the graphics context to use for painting.protected Dimension calcPreferredSize()
Component
calcPreferredSize
in class Component
public 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()
Animated
animate
in interface Animated
animate
in class Component
|
Java DTV API 1.0 12-Dec-2008 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |