Interface IconHolder

All Known Subinterfaces:
SelectableIconHolder
All Known Implementing Classes:
Button, CheckBox, DefaultListCellRenderer, FloatingActionButton, Label, LikeButton, MultiButton, Picker, RadioButton, ScaleImageButton, ScaleImageLabel, ShareButton, Slider, SliderBridge, SpanButton, SpanLabel, SpanMultiButton

public interface IconHolder
An interface implemented by Component classes that can display an icon. E.g. Label, SpanLabel, SpanButton, etc..
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the gap in pixels between the icon/text to the Label boundaries
    Returns the labels icon
    Gets the component that should be used for styling material the material icon.
    Gets the UIID used for styling material icons on this component.
    int
    Returns The position of the text relative to the icon
    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 icon)
    Sets the Label icon, if the icon is unmodified a repaint would not be triggered
    void
    Sets a UIID to be used for the material icon style.
    void
    setMaterialIcon(char c, float size)
    This method is shorthand for char, float)
    void
    setTextPosition(int textPosition)
    Sets the position of the text relative to the icon if exists
  • Method Details

    • getIcon

      Image getIcon()

      Returns the labels icon

      Returns

      the labels icon

    • setIcon

      void setIcon(Image icon)

      Sets the Label icon, if the icon is unmodified a repaint would not be triggered

      Parameters
      • icon: the image that the label presents.
    • getGap

      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

    • setGap

      void setGap(int gap)

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

      Parameters
      • gap: the gap in pixels
    • getTextPosition

      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

    • setTextPosition

      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

    • getIconUIID

      String getIconUIID()
      Gets the UIID used for styling material icons on this component.
    • setIconUIID

      void setIconUIID(String uiid)

      Sets a UIID to be used for the material icon style.

      Parameters
      • uiid: The uiid to use for the material icon style.
      Since

      7.0

    • getIconStyleComponent

      Component getIconStyleComponent()

      Gets the component that should be used for styling material the material icon. If #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.

      Returns

      The component to use for styling the material icon.

      Since

      7.0

    • setMaterialIcon

      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

      Since

      8.0

    • setFontIcon

      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

      Since

      8.0