# Class SpanLabel

java.lang.Object
com.codename1.ui.Component
com.codename1.ui.Container
com.codename1.components.SpanLabel

All Implemented Interfaces:
  `Animation, Editable, StyleListener, IconHolder, TextHolder, Iterable<Component>`

public class SpanLabel extends Container implements IconHolder, TextHolder

A multi line label component that can be easily localized, this is simply based on a text area combined with a label.

    Form hi = new Form("Test SpanLabel", BoxLayout.y());

    Image icon = FontImage.createMaterial(FontImage.MATERIAL_INFO, "Label", 3.0f);

    SpanLabel d = new SpanLabel("Default SpanLabel that can seamlessly line break when the text is really long.");
    d.setIcon(icon);
    SpanLabel l = new SpanLabel("NORTH Positioned Icon SpanLabel that can seamlessly line break when the text is really long.");
    l.setIcon(icon);
    l.setIconPosition(BorderLayout.NORTH);
    SpanLabel r = new SpanLabel("SOUTH Positioned Icon SpanLabel that can seamlessly line break when the text is really long.");
    r.setIcon(icon);
    r.setIconPosition(BorderLayout.SOUTH);
    SpanLabel c = new SpanLabel("EAST Positioned Icon SpanLabel that can seamlessly line break when the text is really long.");
    c.setIcon(icon);
    c.setIconPosition(BorderLayout.EAST);
    hi.add(d).add(l).add(r).add(c);
    hi.show();

- ## Field Summary

  ### Fields inherited from class Component

  `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 Summary

  Constructors
  Constructor
  Description
  `SpanLabel()`
  Default constructor will be useful when adding this to the GUI builder
  `SpanLabel(String txt)`
  Constructor accepting default text
  `SpanLabel(String txt, String textUiid)`
  Constructor accepting default text and uiid for the text

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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 image of the icon
  `Font`
  `getIconFont()`
  Returns the font for the icon font or null if not font set
  `String`
  `getIconPosition()`
  Returns the icon position based on border layout constraints
  `Component`
  `getIconStyleComponent()`
  Gets the component used for styling font icons on this SpanLabel.
  `String`
  `getIconUIID()`
  Returns the UIID for the icon
  `int`
  `getIconValign()`
  Gets the vertical alignment of the icon with respect to the text of the span label.
  `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
  `int`
  `getPreferredW()`
  Helper method to retrieve the preferred width of the component.
  `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
  `String`
  `getText()`
  Returns the text of the label
  `Style`
  `getTextAllStyles()`
  Returns the Style proxy object for the text of this span button.
  `int`
  `getTextBlockAlign()`
  Returns the alignment of the whole text block and not the text within it!
  `TextArea`
  `getTextComponent()`
  Returns the TextArea holding the actual text
  `int`
  `getTextPosition()`
  Returns The position of the text relative to the icon
  `Style`
  `getTextSelectedStyle()`
  Returns the text elements style object
  `String`
  `getTextUIID()`
  Returns the uiid of the actual text
  `Style`
  `getTextUnselectedStyle()`
  Returns the text elements style object
  `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`
  `isShouldLocalize()`
  Indicates if text should be localized when set to the component, by default all text is localized so this allows disabling automatic localization for a specific component.
  `boolean`
  `isTextSelectionEnabled()`
  Checks if text selection is enabled on this SpanLabel.
  `void`
  `setFontIcon(Font font, char c)`
  This method is shorthand for `com.codename1.ui.Font, char)`
  `void`
  `setFontIcon(Font font, char c, float size)`
  This method is shorthand for `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 i)`
  Sets the icon for the label
  `void`
  `setIconPosition(String t)`
  Sets the icon position based on border layout constraints
  `void`
  `setIconUIID(String uiid)`
  Sets the uiid for the icon if present
  `void`
  `setIconValign(int align)`
  Sets the vertical alignment of the icon with respect to the text of the span label.
  `void`
  `setMaterialIcon(char c)`
  This method is shorthand for `char)`
  `void`
  `setMaterialIcon(char c, float size)`
  This method is shorthand for `char, float)`
  `void`
  `setPreferredW(int preferredW)`
  Helper method to set the preferred width of the component.
  `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`
  `setShouldLocalize(boolean shouldLocalize)`
  Indicates if text should be localized when set to the component, by default all text is localized so this allows disabling automatic localization for a specific component.
  `void`
  `setText(String t)`
  Set the text of the label
  `void`
  `setTextBlockAlign(int align)`
  Indicates the alignment of the whole text block, this is different from setting the alignment of the text within the block since the UIID might have a border or other design element that won't be affected by such alignment.
  `void`
  `setTextPosition(int textPosition)`
  Sets the position of the text relative to the icon if exists
  `void`
  `setTextSelectedStyle(Style t)`
  The text elements style object
  `void`
  `setTextSelectionEnabled(boolean enabled)`
  Enables or disables text selection on this span label.
  `void`
  `setTextUIID(String uiid)`
  Sets the UIID for the actual text
  `void`
  `setTextUnselectedStyle(Style t)`
  The text elements style object
  `void`
  `setUIID(String id)`
  This method sets the Component the Unique identifier.
  `void`
  `setWidth(int width)`
  Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.
  `void`
  `styleChanged(String propertyName, Style source)`
  Invoked to indicate a change in a propertyName of a Style

  ### Methods inherited from class Container

  `add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices`

  ### Methods inherited from class Component

  `addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, animate, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, 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, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, 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, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, 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, setPressedStyle, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIIDFinal, setUnselectedStyle, setVisible, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Iterable

  `forEach`

- ## Constructor Details

  - ### SpanLabel

    public SpanLabel()
    Default constructor will be useful when adding this to the GUI builder

  - ### SpanLabel

    public SpanLabel(String txt, String textUiid)

    Constructor accepting default text and uiid for the text

    ###### Parameters

    - `txt`: the text

    - `textUiid`: the new text UIID

  - ### SpanLabel

    public SpanLabel(String txt)
    Constructor accepting default text

- ## Method Details

  - ### styleChanged

    public void styleChanged(String propertyName, Style source)
    Description copied from class: `Component`

    Invoked to indicate a change in a propertyName of a Style

    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.

    ###### Parameters

    - `propertyName`: the property name that was changed

    - `source`: The changed Style object

    Specified by:
      `styleChanged` in interface `StyleListener`
    Overrides:
      `styleChanged` in class `Component`

  - ### initUnselectedStyle

    protected void initUnselectedStyle(Style unselectedStyle)
    Description copied from class: `Component`

    Can be overridden by subclasses to perform initialization when the unselected style is set to a new value.

    ###### Parameters

    - `unselectedStyle`: The unselected style.

    ###### Since

    8.0

    Overrides:
      `initUnselectedStyle` in class `Component`

  - ### initLaf

    protected void initLaf(UIManager uim)
    Description copied from class: `Container`
    This method initializes the Component defaults constants
    Overrides:
      `initLaf` in class `Container`

  - ### getPreferredW

    public int getPreferredW()

    Helper method to retrieve the preferred width of the component.

    ###### Returns

    preferred width of the component

    ###### See also

    - #getPreferredSize
    Overrides:
      `getPreferredW` in class `Component`

  - ### setPreferredW

    public void setPreferredW(int preferredW)

    Helper method to set the preferred width of the component.

    ###### Parameters

    - `preferredW`: the preferred width of the component

    ###### Deprecated

    Overrides:
      `setPreferredW` in class `Component`

  - ### getIconStyleComponent

    public Component getIconStyleComponent()

    Gets the component used for styling font icons on this SpanLabel.

    ###### Returns

    The component used for styling font icons on this SpanLabel.

    ###### Since

    7.0

    Specified by:
      `getIconStyleComponent` in interface `IconHolder`

  - ### getTextComponent

    public TextArea getTextComponent()

    Returns the TextArea holding the actual text

    ###### Returns

    the component

  - ### setUIID

    public void setUIID(String id)
    Description copied from class: `Component`

    This method sets the Component the Unique identifier. This method should be used before a component has been initialized

    ###### Parameters

    - `id`: UIID unique identifier for component type
    Overrides:
      `setUIID` in class `Component`

  - ### getTextUIID

    public String getTextUIID()

    Returns the uiid of the actual text

    ###### Returns

    the uiid

  - ### setTextUIID

    public void setTextUIID(String uiid)

    Sets the UIID for the actual text

    ###### Parameters

    - `uiid`: the uiid

  - ### getTextAllStyles

    public Style getTextAllStyles()

    Returns the Style proxy object for the text of this span button.

    ###### Returns

    The Style object for the text of this span button.

  - ### getTextUnselectedStyle

    public Style getTextUnselectedStyle()

    Returns the text elements style object

    ###### Returns

    the style object

  - ### setTextUnselectedStyle

    public void setTextUnselectedStyle(Style t)

    The text elements style object

    ###### Parameters

    - `t`: the style object

  - ### getTextSelectedStyle

    public Style getTextSelectedStyle()

    Returns the text elements style object

    ###### Returns

    the style object

  - ### setTextSelectedStyle

    public void setTextSelectedStyle(Style t)

    The text elements style object

    ###### Parameters

    - `t`: the style object

  - ### getIconUIID

    public String getIconUIID()

    Returns the UIID for the icon

    ###### Returns

    the uiid

    Specified by:
      `getIconUIID` in interface `IconHolder`

  - ### setIconUIID

    public void setIconUIID(String uiid)

    Sets the uiid for the icon if present

    ###### Parameters

    - `uiid`: the uiid for the icon
    Specified by:
      `setIconUIID` in interface `IconHolder`

  - ### getIconValign

    public int getIconValign()

    Gets the vertical alignment of the icon with respect to the text of the span label.

    ###### Returns

    The alignment. One of `#TOP`, `#BOTTOM`, or `#CENTER`.

    ###### Since

    7.0

  - ### setIconValign

    public void setIconValign(int align)

    Sets the vertical alignment of the icon with respect to the text of the span label. Default value is `#CENTER`

    ###### Parameters

    - `align`: One of `#TOP`, `#BOTTOM`, or `#CENTER`.

    ###### Since

    7.0

  - ### getText

    public String getText()

    Returns the text of the label

    ###### Returns

    the text

    Specified by:
      `getText` in interface `TextHolder`

  - ### setText

    public void setText(String t)

    Set the text of the label

    ###### Parameters

    - `t`: text of the label
    Specified by:
      `setText` in interface `TextHolder`

  - ### getTextBlockAlign

    public int getTextBlockAlign()

    Returns the alignment of the whole text block and not the text within it!

    ###### Returns

    -1 for unaligned otherwise one of Component.LEFT/RIGHT/CENTER

  - ### setTextBlockAlign

    public void setTextBlockAlign(int align)

    Indicates the alignment of the whole text block, this is different from setting the alignment of the text within the block since the UIID might have a border or other design element that won't be affected by such alignment. The default is none (-1) which means no alignment takes place and the text block takes the whole width.

    ###### Parameters

    - `align`: @param align valid values are Component.LEFT, Component.RIGHT, Component.CENTER. Anything else will stretch the text block

  - ### getIcon

    public Image getIcon()

    Returns the image of the icon

    ###### Returns

    the icon

    Specified by:
      `getIcon` in interface `IconHolder`

  - ### setIcon

    public void setIcon(Image i)

    Sets the icon for the label

    ###### Parameters

    - `i`: the icon
    Specified by:
      `setIcon` in interface `IconHolder`

  - ### getIconPosition

    public String getIconPosition()

    Returns the icon position based on border layout constraints

    ###### Returns

    position either North/South/East/West

  - ### setIconPosition

    public void setIconPosition(String t)

    Sets the icon position based on border layout constraints

    ###### Parameters

    - `t`: position either North/South/East/West

  - ### getPropertyNames

    public 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

    ###### Returns

    the property names allowing mutation

    Overrides:
      `getPropertyNames` in class `Component`

  - ### getPropertyTypes

    public Class[] getPropertyTypes()

    Matches the property names method (see that method for further details).

    ###### Returns

    the types of the properties

    Overrides:
      `getPropertyTypes` in class `Component`

  - ### getPropertyTypeNames

    public 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

    ###### Returns

    Array of type names

    Overrides:
      `getPropertyTypeNames` in class `Component`

  - ### getPropertyValue

    public Object getPropertyValue(String name)

    Returns the current value of the property name, this method is used by the GUI builder

    ###### Parameters

    - `name`: the name of the property

    ###### Returns

    the value of said property

    Overrides:
      `getPropertyValue` in class `Component`

  - ### setPropertyValue

    public String setPropertyValue(String name, Object value)

    Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

    ###### Parameters

    - `name`: the name of the property

    - `value`: new value for the property

    ###### Returns

    error message or null

    Overrides:
      `setPropertyValue` in class `Component`

  - ### isShouldLocalize

    public boolean isShouldLocalize()

    Indicates if text should be localized when set to the component, by default all text is localized so this allows disabling automatic localization for a specific component.

    ###### Returns

    the shouldLocalize value

  - ### setShouldLocalize

    public void setShouldLocalize(boolean shouldLocalize)

    Indicates if text should be localized when set to the component, by default all text is localized so this allows disabling automatic localization for a specific component.

    ###### Parameters

    - `shouldLocalize`: the shouldLocalize to set

  - ### isTextSelectionEnabled

    public boolean isTextSelectionEnabled()

    Checks if text selection is enabled on this SpanLabel. Note that the Form must also have text selection enabled for text selection to work.

    ###### Returns

    True if text selection is enabled on this element.

    ###### Since

    7.0

    ###### See also

    - Form#getTextSelection()

    - TextSelection#setEnabled(boolean)

  - ### setTextSelectionEnabled

    public void setTextSelectionEnabled(boolean enabled)

    Enables or disables text selection on this span label. Default is off.

    ###### Parameters

    - `enabled`: True to enable text selection on this label.

    ###### Since

    7.0

  - ### setWidth

    public void setWidth(int width)

    Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.

    If a user wishes to affect the component size, setPreferredSize should be used.

    ###### Parameters

    - `width`: the width of the component

    ###### See also

    - #setPreferredSize
    Overrides:
      `setWidth` in class `Component`

  - ### getGap

    public int getGap()

    Returns the gap in pixels between the icon/text to the Label boundaries

    ###### Returns

    the gap in pixels between the icon/text to the Label boundaries

    ###### Since

    7.0

    Specified by:
      `getGap` in interface `IconHolder`

  - ### setGap

    public void setGap(int gap)

    Set the gap in pixels between the icon/text to the Label boundaries

    ###### Parameters

    - `gap`: the gap in pixels

    ###### Since

    7.0

    Specified by:
      `setGap` in interface `IconHolder`

  - ### getTextPosition

    public int getTextPosition()

    Returns The position of the text relative to the icon

    ###### Returns

    The position of the text relative to the icon, one of: LEFT, RIGHT, BOTTOM, TOP

    ###### See also

    - #LEFT

    - #RIGHT

    - #BOTTOM

    - #TOP

    ###### Since

    7.0

    Specified by:
      `getTextPosition` in interface `IconHolder`

  - ### setTextPosition

    public void setTextPosition(int textPosition)

    Sets the position of the text relative to the icon if exists

    ###### Parameters

    - `textPosition`: alignment value (LEFT, RIGHT, BOTTOM or TOP)

    ###### See also

    - #LEFT

    - #RIGHT

    - #BOTTOM

    - #TOP

    ###### Since

    7.0

    Specified by:
      `setTextPosition` in interface `IconHolder`

  - ### setFontIcon

    public void setFontIcon(Font font, char c)

    This method is shorthand for `com.codename1.ui.Font, char)`

    ###### Parameters

    - `c`: one of the constants from the font

  - ### setMaterialIcon

    public void setMaterialIcon(char c, float size)

    This method is shorthand for `char, float)`

    ###### Parameters

    - `c`: one of the constants from `com.codename1.ui.FontImage`

    - `size`: the size of the icon in millimeters

    Specified by:
      `setMaterialIcon` in interface `IconHolder`

  - ### setFontIcon

    public void setFontIcon(Font font, char c, float size)

    This method is shorthand for `com.codename1.ui.Font, char, float)`

    ###### Parameters

    - `c`: one of the constants from the font

    - `size`: the size of the icon in millimeters

    Specified by:
      `setFontIcon` in interface `IconHolder`

  - ### getMaterialIcon

    public char getMaterialIcon()

    Returns the material icon assigned to this component or 0 if not applicable

    ###### Returns

    the material icon

  - ### setMaterialIcon

    public void setMaterialIcon(char c)

    This method is shorthand for `char)`

    ###### Parameters

    - `c`: one of the constants from `com.codename1.ui.FontImage`

  - ### getFontIcon

    public char getFontIcon()

    Returns the font icon assigned to this component or 0 if not applicable

    ###### Returns

    the material icon

  - ### getMaterialIconSize

    public float getMaterialIconSize()

    Returns the material icon size assigned to this component or 0/-1 if not applicable

    ###### Returns

    the material icon size

  - ### getFontIconSize

    public float getFontIconSize()

    Returns the icon size assigned to this component or 0/-1 if not applicable

    ###### Returns

    the icon size

  - ### getIconFont

    public Font getIconFont()

    Returns the font for the icon font or null if not font set

    ###### Returns

    the material icon size