|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.lwuit.Component com.sun.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 alignement/icon look in a similar way.
Field Summary |
---|
Fields inherited from class com.sun.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Constructor Summary | |
---|---|
Label()
Construct an empty label |
|
Label(Image icon)
Constructs a new label with the specified icon |
|
Label(java.lang.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()
Deprecated. use Style.getAlignment instead |
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 |
java.lang.String |
getText()
Returns the label text |
int |
getTextPosition()
Returns The position of the text relative to the icon |
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 bellow it. |
static boolean |
isDefaultTickerEnabled()
Allows disabling/enabling tickers globally |
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)
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. |
protected java.lang.String |
paramString()
Returns a string representing the state of this component. |
void |
setAlignment(int align)
Deprecated. use Style.setAlignment instead |
static void |
setDefaultTickerEnabled(boolean aDefaultTickerEnabled)
Allows disabling/enabling tickers globally |
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, if the icon is unmodified a repaint would not be triggered |
void |
setShiftText(int shiftText)
This method shifts the text from it's position in pixels. |
void |
setText(java.lang.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 |
boolean |
shouldTickerStart()
Returns true if a ticker should be started since there is no room to show the text in the label. |
void |
startTicker()
This method will start the text ticker |
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 |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Label(java.lang.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(java.lang.String text)
text
- the string that the label presents.public java.lang.String getText()
public void setIcon(Image icon)
icon
- the image that the label presents.public Image getIcon()
public void setAlignment(int align)
align
- alignment valueComponent.CENTER
,
Component.LEFT
,
Component.RIGHT
public void setVerticalAlignment(int valign)
valign
- alignment valueComponent.CENTER
,
Component.TOP
,
Component.BOTTOM
public int getVerticalAlignment()
Component.CENTER
,
Component.TOP
,
Component.BOTTOM
public int getAlignment()
Component.CENTER
,
Component.LEFT
,
Component.RIGHT
public void setTextPosition(int textPosition)
textPosition
- alignment value (LEFT, RIGHT, BOTTOM or TOP)Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public int getTextPosition()
Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public void setGap(int gap)
gap
- the gap in pixelspublic int getGap()
protected java.lang.String paramString()
Component
null
.
paramString
in class Component
public void paint(Graphics g)
Component
paint
in interface Animation
paint
in class Component
g
- the component graphicsprotected Dimension calcPreferredSize()
Component
calcPreferredSize
in class Component
public int getShiftText()
public void setShiftText(int shiftText)
shiftText
- The number of pixels to move the textpublic boolean shouldTickerStart()
public void startTicker()
public void startTicker(long delay, boolean rightToLeft)
delay
- the delay in millisecods between animation intervalsrightToLeft
- if true move the text to the leftpublic void stopTicker()
public boolean isTickerRunning()
public void setTickerEnabled(boolean tickerEnabled)
tickerEnabled
- public boolean isTickerEnabled()
public void setEndsWith3Points(boolean endsWith3Points)
endsWith3Points
- true if text should add "..." at the endpublic boolean isEndsWith3Points()
public boolean animate()
Animation
Display
class.
animate
in interface Animation
animate
in class Component
public static boolean isDefaultTickerEnabled()
public static void setDefaultTickerEnabled(boolean aDefaultTickerEnabled)
aDefaultTickerEnabled
- the defaultTickerEnabled to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |