Class TLcdTextIcon

java.lang.Object
com.luciad.gui.TLcdTextIcon
All Implemented Interfaces:
ILcdIcon, ILcdCloneable, Serializable, Cloneable

public class TLcdTextIcon extends Object implements ILcdIcon
Multi-line text icon.
The icon is immutable and uses the builder-pattern: see newBuilder() to create a new icon and asBuilder() to modify an existing one.

See the TLcdTextIcon.Builder.lines(java.util.List<java.lang.String>) method to change the text.

The rendering can be configured in the following ways:

The dimensions of the icon are automatically determined based on the content and font.
Since:
2018.1
See Also:
  • Method Details

    • getLines

      public List<String> getLines()
      Returns the content to display
      Returns:
      the list of lines to display
    • paintIcon

      public void paintIcon(Component aComponent, Graphics aGraphics, int aX, int aY)
      Description copied from interface: ILcdIcon
      Draw the ILcdIcon at the specified location. ILcdIcon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.
      Specified by:
      paintIcon in interface ILcdIcon
      Parameters:
      aComponent - a Component to retrieve properties from.
      aGraphics - the Graphics on which the icon will be painted.
      aX - the x position where the icon will be painted. x is the first coordinate of the top left corner point of the icon.
      aY - the y position where the icon will be painted. y is the second coordinate of the top left corner point of the icon.
    • getHorizontalAlignment

      public ELcdHorizontalAlignment getHorizontalAlignment()
      Returns the alignment of the lines in the icon.
      Returns:
      the alignment of the lines in the icon
    • getFont

      public Font getFont()
      Returns the font for drawing the text. The default value is plain Dialog of size 13.
      Returns:
      the font used to paint text.
    • getForeground

      public Color getForeground()
      Returns the color of the text and frame.
      Returns:
      the foreground color, or null if no color is configured
    • getVerticalSpacing

      public int getVerticalSpacing()
      Returns the vertical spacing in between the icon's text lines.
      Returns:
      the vertical spacing used between lines, in pixels.
    • getIconWidth

      public int getIconWidth()
      Description copied from interface: ILcdIcon
      Returns the fixed width of the icon.
      Specified by:
      getIconWidth in interface ILcdIcon
      Returns:
      the fixed width of the icon.
    • getIconHeight

      public int getIconHeight()
      Description copied from interface: ILcdIcon
      Returns the fixed height of the icon.
      Specified by:
      getIconHeight in interface ILcdIcon
      Returns:
      the fixed height of the icon.
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • isAntiAliased

      public boolean isAntiAliased()
      Returns if anti-aliasing is enabled.
      Returns:
      if anti-aliasing is enabled.
    • equals

      public boolean equals(Object aO)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • newBuilder

      public static TLcdTextIcon.Builder newBuilder()
      Returns a builder for creating a new text icon.
      Returns:
      a new text icon builder
    • asBuilder

      public TLcdTextIcon.Builder asBuilder()
      Creates a new builder initialized with all the properties of this text icon.
      Returns:
      the new builder.