public class Label extends Component implements IconHolder, TextHolder
Allows displaying a single line of text and icon (both optional) with different alignment options. This class is a base class for several components allowing them to declare alignment/icon appearance universally.
Label text can be positioned in one of 4 locations as such:
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
Label()
Construct an empty label
|
Label(Image icon)
Constructs a new label with the specified icon
|
Label(Image icon,
String uiid)
Constructs a new label with the specified icon and UIID
|
Label(String text)
Constructs a new label with the specified string of text, left justified.
|
Label(String text,
Image icon)
Constructs a new label with the specified icon and text
|
Label(String text,
Image icon,
String uiid)
Constructs a new label with the specified icon text and UIID
|
Label(String text,
String uiid)
Constructs a new label with the specified string of text and uiid
|
Modifier and Type | Method and Description |
---|---|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false.
|
void |
bindProperty(String prop,
BindTarget target)
Binds the given property name to the given bind target
|
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content.
|
int |
getAlignment()
Deprecated.
use Style.getAlignment instead
|
Component |
getBadgeStyleComponent()
Gets a component that can be used for the style of the badge.
|
String |
getBadgeText()
Gets the text to be used in a badge on this label.
|
int |
getBaseline(int width,
int height)
The baseline for the component text according to which it should be aligned
with other components for best visual look.
|
int |
getBaselineResizeBehavior()
Returns a constant indicating how the baseline varies with the size
of the component.
|
String[] |
getBindablePropertyNames()
Returns the names of the properties within this component that can be bound for persistence,
the order of these names mean that the first one will be the first bound
|
Class[] |
getBindablePropertyTypes()
Returns the types of the properties that are bindable within this component
|
Object |
getBoundPropertyValue(String prop)
Allows the binding code to extract the value of the property
|
static int |
getDefaultGap()
Returns the default gap in pixels between the icon/text to the Label boundaries
|
char |
getFontIcon()
Returns the font icon assigned to this component or 0 if not applicable
|
float |
getFontIconSize()
Returns the icon size assigned to this component or 0/-1 if
not applicable
|
int |
getGap()
Returns the gap in pixels between the icon/text to the Label boundaries
|
Image |
getIcon()
Returns the labels icon
|
Font |
getIconFont()
Returns the font for the icon font or null if not font set
|
Component |
getIconStyleComponent()
Gets the component that should be used for styling material the material icon.
|
String |
getIconUIID()
Gets the UIID used for styling material icons on this component.
|
Object |
getMask()
Returns the mask matching the given image
|
Image |
getMaskedIcon()
If a mask is applied returns the icon with a mask, otherwise returns the icon
|
String |
getMaskName()
Determines the name of the mask from the image constants thus allowing the mask to be applied from the theme
|
char |
getMaterialIcon()
Returns the material icon assigned to this component or 0 if not applicable
|
float |
getMaterialIconSize()
Returns the material icon size assigned to this component or 0/-1 if
not applicable
|
float |
getMaxAutoSize()
Allows us to limit the maximum size for the autosize mode
|
float |
getMinAutoSize()
Allows us to limit the minimum size for the autosize mode
|
String[] |
getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this
API is designed for usage internally by the GUI builder code
|
String[] |
getPropertyTypeNames()
This method is here to workaround an XMLVM array type bug where property types aren't
identified properly, it returns the names of the types using the following type names:
String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer
|
Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder
|
int |
getShiftMillimeters()
Deprecated.
|
float |
getShiftMillimetersF()
Returns the number of millimeters that should be shifted in tickering as a float.
|
int |
getShiftText()
Simple getter to return how many pixels to shift the text inside the Label
|
int |
getStringWidth(Font fnt)
This method is equivalent to label.getStyle().getFont().stringWidth(label.getText()) but its faster
|
String |
getText()
Returns the label text
|
int |
getTextPosition()
Returns The position of the text relative to the icon
|
TextSelection.TextSelectionSupport |
getTextSelectionSupport()
Returns text selection support object for this 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.
|
protected void |
initLaf(UIManager uim)
This method initializes the Component defaults constants
|
protected void |
initUnselectedStyle(Style unselectedStyle)
Can be overridden by subclasses to perform initialization when the unselected style is set to a new value.
|
boolean |
isAutoSizeMode()
Autosize mode automatically shrinks/grows the font of the label to fit in the available width, it carries
a noticeable performance penalty and we recommend you avoid using it unless absolutely necessary
|
static boolean |
isDefaultTickerEnabled()
Allows disabling/enabling tickers globally
|
boolean |
isEndsWith3Points()
If the Label text is too long fit the text to the widget and adds "
... "
points at the end. |
boolean |
isLegacyRenderer()
Fallback to the old default look and feel renderer for cases where compatibility is essential
|
boolean |
isShouldLocalize()
Indicates if text should be localized when set to the label, by default
all text is localized so this allows disabling automatic localization for
a specific label.
|
boolean |
isShowEvenIfBlank()
By default labels and subclasses become 0 sized when they are blank even ignoring their padding
setting this to true makes the padding take effect even in a blank field.
|
boolean |
isTextSelectionEnabled()
Returns true if text selection is enabled on this label.
|
boolean |
isTickerEnabled()
This method return true if the ticker is enabled on this Label
|
boolean |
isTickerRunning()
Returns true if the ticker is running
|
protected void |
laidOut()
This is a callback method to inform the Component when it's been laidout
on the parent Container
|
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 String |
paramString()
Returns a string representing the state of this component.
|
void |
refreshTheme(boolean merge)
Makes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME!
|
void |
setAlignment(int align)
Deprecated.
use Style.setAlignment instead
|
void |
setAutoSizeMode(boolean autoSizeMode)
Autosize mode automatically shrinks/grows the font of the label to fit in the available width, it carries
a noticeable performance penalty and we recommend you avoid using it unless absolutely necessary
|
void |
setBadgeText(String badgeText)
Sets the badge text to be used on this label.
|
void |
setBadgeUIID(String badgeUIID)
Sets the style that should be used for rendering badges.
|
void |
setBoundPropertyValue(String prop,
Object value)
Sets the value of a bound property within this component, notice that this method MUST NOT fire
the property change event when invoked to prevent recursion!
|
static void |
setDefaultGap(int gap)
Set the default gap in pixels between the icon/text to the Label boundaries
|
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 adds "
... "
points at the end. |
void |
setFontIcon(char c)
Sets an icon font using either the same icon font that was used to set the icon font last, or using the font
from the icon UIID.
|
void |
setFontIcon(Font font,
char c)
This method is shorthand for
com.codename1.ui.FontImage#setMaterialIcon(com.codename1.ui.Label, com.codename1.ui.Font, char) |
void |
setFontIcon(Font font,
char c,
float size)
This method is shorthand for
FontImage.setFontIcon(com.codename1.ui.Label, com.codename1.ui.Font, char, float) |
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 |
setIconUIID(String uiid)
Sets a UIID to be used for the material icon style.
|
void |
setLegacyRenderer(boolean legacyRenderer)
Fallback to the old default look and feel renderer for cases where compatibility is essential
|
void |
setMask(Object mask)
A mask image can be applied to the label (see the image mask method for details)
which allows for things like rounded image appearance etc.
|
void |
setMaskName(String maskName)
Determines the name of the mask from the image constants thus allowing the mask to be applied from the theme
|
void |
setMaterialIcon(char c)
This method is shorthand for
FontImage.setMaterialIcon(com.codename1.ui.Label, char) |
void |
setMaterialIcon(char c,
float size)
This method is shorthand for
FontImage.setMaterialIcon(com.codename1.ui.Label, char, float) |
void |
setMaxAutoSize(float maxSize)
Allows us to limit the maximum size for the autosize mode
|
void |
setMinAutoSize(float minSize)
Allows us to limit the minimum size for the autosize mode
|
String |
setPropertyValue(String name,
Object value)
Sets a new value to the given property, returns an error message if failed
and null if successful.
|
void |
setShiftMillimeters(float shiftMillimeters)
Sets the millimeters that should be shifted in tickering as a float.
|
void |
setShiftMillimeters(int shiftMillimeters)
Sets the millimeters that should be shifted in tickering
|
void |
setShiftText(int shiftText)
This method shifts the text from it's position in pixels.
|
void |
setShouldLocalize(boolean shouldLocalize)
Indicates if text should be localized when set to the label, by default
all text is localized so this allows disabling automatic localization for
a specific label.
|
void |
setShowEvenIfBlank(boolean showEvenIfBlank)
By default labels and subclasses become 0 sized when they are blank even ignoring their padding
setting this to true makes the padding take effect even in a blank field.
|
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 |
setTextSelectionEnabled(boolean enabled)
Enables text selection on this label.
|
void |
setTickerEnabled(boolean tickerEnabled)
Sets the Label to allow ticking of the text.
|
void |
setUIID(String id)
This method sets the Component the Unique identifier.
|
void |
setVerticalAlignment(int valign)
Sets the vertical alignment of the Label to one of: CENTER, TOP, BOTTOM, BASELINE
The valign property is only relevant relatively to the icon and not the entire label, this will
only work when there is an icon
|
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
|
void |
styleChanged(String propertyName,
Style source)
Invoked to indicate a change in a propertyName of a Style
|
void |
unbindProperty(String prop,
BindTarget target)
Removes a bind target from the given property name
|
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, blocksSideSwipe, calcScrollSize, cancelRepaints, clearClientProperties, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, dragInitiated, drawDraggedImage, drop, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBorder, getBottomGap, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getGridPosX, getGridPosY, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTabIndex, getTensileLength, getTooltip, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyPressed, keyReleased, keyRepeated, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, toImage, toString, updateNativeOverlay, visibleBoundsContains
public Label(String text)
text
- the string that the label presents.public Label(String text, String uiid)
text
- the string that the label presents.uiid
- the uiid for the labelpublic Label()
public Label(Image icon)
icon
- the image that the label presents.public Label(Image icon, String uiid)
icon
- the image that the label presents.uiid
- the uiid for the labelpublic Label(String text, Image icon, String uiid)
text
- the text of the labelicon
- the image that the label presents.uiid
- the uiid for the labelprotected void laidOut()
public void setBadgeText(String badgeText)
setBadgeUIID(java.lang.String)
, but the default style uses
the "Badge" UIID, which, by default, uses white text on a red round border background.badgeText
- The text to include in the badge. null or empty strings will result in the
badge not being rendered.getBadgeText()
,
getBadgeStyleComponent()
,
setBadgeUIID(java.lang.String)
public String getBadgeText()
setBadgeText(java.lang.String)
,
setBadgeUIID(java.lang.String)
,
getBadgeStyleComponent()
public void setBadgeUIID(String badgeUIID)
badgeUIID
- The UIID to use for the badge.setBadgeText(java.lang.String)
,
getBadgeStyleComponent()
public Component getBadgeStyleComponent()
setBadgeText(java.lang.String)
,
setBadgeUIID(java.lang.String)
,
getBadgeText()
public void setIconUIID(String uiid)
setIconUIID
in interface IconHolder
uiid
- The uiid to use for the material icon style.public Component getIconStyleComponent()
setIconUIID(java.lang.String)
has been used
to set a custom UIID for the icon, then this will return a component with that UIID. Otherwise this will just return this component
itself.getIconStyleComponent
in interface IconHolder
public void setMaterialIcon(char c)
FontImage.setMaterialIcon(com.codename1.ui.Label, char)
c
- one of the constants from FontImage
public void setFontIcon(Font font, char c)
com.codename1.ui.FontImage#setMaterialIcon(com.codename1.ui.Label, com.codename1.ui.Font, char)
c
- one of the constants from the fontpublic void setFontIcon(char c)
c
- The character to render in the font.public void setMaterialIcon(char c, float size)
FontImage.setMaterialIcon(com.codename1.ui.Label, char, float)
setMaterialIcon
in interface IconHolder
c
- one of the constants from FontImage
size
- the size of the icon in millimeterspublic void setFontIcon(Font font, char c, float size)
FontImage.setFontIcon(com.codename1.ui.Label, com.codename1.ui.Font, char, float)
setFontIcon
in interface IconHolder
c
- one of the constants from the fontsize
- the size of the icon in millimeterspublic char getMaterialIcon()
public char getFontIcon()
public float getMaterialIconSize()
public float getFontIconSize()
public Font getIconFont()
public int getBaselineResizeBehavior()
getBaselineResizeBehavior
in class Component
public int getBaseline(int width, int height)
Component
getBaseline
in class Component
width
- the component widthheight
- the component heightpublic void setUIID(String id)
public void refreshTheme(boolean merge)
refreshTheme
in class Component
merge
- indicates if the current styles should be merged with the new stylespublic void setText(String text)
setText
in interface TextHolder
text
- the string that the label presents.protected void initLaf(UIManager uim)
Component
public String getText()
getText
in interface TextHolder
public void setIcon(Image icon)
setIcon
in interface IconHolder
icon
- the image that the label presents.public Image getIcon()
getIcon
in interface IconHolder
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
,
Component.BASELINE
public int getVerticalAlignment()
Component.CENTER
,
Component.TOP
,
Component.BOTTOM
,
Component.BASELINE
public int getAlignment()
Component.CENTER
,
Component.LEFT
,
Component.RIGHT
public void setTextPosition(int textPosition)
setTextPosition
in interface IconHolder
textPosition
- alignment value (LEFT, RIGHT, BOTTOM or TOP)Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public int getTextPosition()
getTextPosition
in interface IconHolder
Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public void setGap(int gap)
setGap
in interface IconHolder
gap
- the gap in pixelspublic int getGap()
getGap
in interface IconHolder
public static void setDefaultGap(int gap)
gap
- the gap in pixelspublic static int getDefaultGap()
protected String paramString()
null
.paramString
in class Component
public void paint(Graphics g)
public void setMaxAutoSize(float maxSize)
maxSize
- the maximum font size in millimeterspublic float getMaxAutoSize()
public void setMinAutoSize(float minSize)
minSize
- the minimum font size in millimeterspublic float getMinAutoSize()
protected Dimension calcPreferredSize()
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)
...
"
points at the end. By default this is set to false
for faster performance.endsWith3Points
- true if text should add "..." at the endpublic boolean isEndsWith3Points()
...
"
points at the end. By default this is set to false
for faster performance.public boolean animate()
Display
class.public static boolean isDefaultTickerEnabled()
public static void setDefaultTickerEnabled(boolean aDefaultTickerEnabled)
aDefaultTickerEnabled
- the defaultTickerEnabled to setpublic void setMask(Object mask)
mask
- the mask returned from the image objectpublic Object getMask()
public String getMaskName()
public void setMaskName(String maskName)
maskName
- the maskName to setpublic String[] getPropertyNames()
getPropertyNames
in class Component
public Class[] getPropertyTypes()
getPropertyTypes
in class Component
public String[] getPropertyTypeNames()
getPropertyTypeNames
in class Component
public Object getPropertyValue(String name)
getPropertyValue
in class Component
name
- the name of the propertypublic String setPropertyValue(String name, Object value)
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the propertypublic Image getMaskedIcon()
public String[] getBindablePropertyNames()
getBindablePropertyNames
in class Component
public Class[] getBindablePropertyTypes()
getBindablePropertyTypes
in class Component
public void bindProperty(String prop, BindTarget target)
bindProperty
in class Component
prop
- the property nametarget
- the target binderpublic void unbindProperty(String prop, BindTarget target)
unbindProperty
in class Component
prop
- the property namestarget
- the target binderpublic Object getBoundPropertyValue(String prop)
getBoundPropertyValue
in class Component
prop
- the propertypublic void setBoundPropertyValue(String prop, Object value)
setBoundPropertyValue
in class Component
prop
- the property whose value should be setvalue
- the valuepublic boolean isShouldLocalize()
public void setShouldLocalize(boolean shouldLocalize)
shouldLocalize
- the shouldLocalize to setpublic int getShiftMillimeters()
getShiftMillimetersF()
public float getShiftMillimetersF()
public void setShiftMillimeters(int shiftMillimeters)
shiftMillimeters
- the shiftMillimeters to setpublic void setShiftMillimeters(float shiftMillimeters)
shiftMillimeters
- the shiftMillimeters to setpublic boolean isShowEvenIfBlank()
public void setShowEvenIfBlank(boolean showEvenIfBlank)
showEvenIfBlank
- the showEvenIfBlank to setpublic int getStringWidth(Font fnt)
fnt
- the font is passed as an optimization to save a call to getStylepublic boolean isLegacyRenderer()
public void setLegacyRenderer(boolean legacyRenderer)
legacyRenderer
- the legacyRenderer to setpublic void styleChanged(String propertyName, Style source)
Component
NOTE By default this will trigger a call to Container.revalidate()
on the parent
container, which is expensive. You can disable this behavior by calling CN.setProperty("Component.revalidateOnStyleChange", "false")
.
The intention is to change this behavior so that the default is to "not" revalidate on style change, so we encourage you to
set this to "false" to ensure for future compatibility.
styleChanged
in interface StyleListener
styleChanged
in class Component
propertyName
- the property name that was changedsource
- The changed Style objectprotected void initUnselectedStyle(Style unselectedStyle)
Component
initUnselectedStyle
in class Component
unselectedStyle
- The unselected style.public boolean isAutoSizeMode()
public void setAutoSizeMode(boolean autoSizeMode)
autoSizeMode
- the autoSizeMode to setpublic void setTextSelectionEnabled(boolean enabled)
enabled
- setTextSelectionEnabled(boolean)
,
Form.getTextSelection()
,
TextSelection.setEnabled(boolean)
public boolean isTextSelectionEnabled()
Form.getTextSelection()
and TextSelection.setEnabled(boolean)
,
and also ensure that the label's text selection is enabled via setTextSelectionEnabled(boolean)
.setTextSelectionEnabled(boolean)
public TextSelection.TextSelectionSupport getTextSelectionSupport()
Component
getTextSelectionSupport
in class Component
public String getIconUIID()
IconHolder
getIconUIID
in interface IconHolder