Module tvbrowser
Package util.ui

Class TextAreaIcon

  • All Implemented Interfaces:
    javax.swing.Icon

    public class TextAreaIcon
    extends java.lang.Object
    implements javax.swing.Icon
    An icon that displays multiline text.
    Author:
    Martin Oberhauser
    • Constructor Summary

      Constructors 
      Constructor Description
      TextAreaIcon​(java.lang.String text, java.awt.Font font, int width)
      Creates a TextAreaIcon with the specified text, font and width.
      TextAreaIcon​(java.lang.String text, java.awt.Font font, int width, int lineSpace)
      Creates a TextAreaIcon with the specified text, font and width.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIconHeight()
      Returns the icon's height.
      int getIconWidth()
      Returns the icon's mWidth.
      int getLineCount()  
      int getMaximumLineCount()
      Get the maximum LineCount
      boolean isTextCut()
      has the text in this icon been cut because it was longer than maxLines?
      void paintIcon​(java.awt.Component comp, java.awt.Graphics grp, int x, int y)
      Draw the icon at the specified location.
      void setMaximumLineCount​(int maxLineCount)
      Sets the maximum Linecount
      void setText​(java.io.Reader textReader)
      Set the Text of this Icon
      void setText​(java.lang.String text)
      Set the Text of this Icon
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextAreaIcon

        public TextAreaIcon​(java.lang.String text,
                            java.awt.Font font,
                            int width,
                            int lineSpace)
        Creates a TextAreaIcon with the specified text, font and width.
        Parameters:
        text - The text.
        font - The font.
        width - The width.
        lineSpace - The line space.
      • TextAreaIcon

        public TextAreaIcon​(java.lang.String text,
                            java.awt.Font font,
                            int width)
        Creates a TextAreaIcon with the specified text, font and width.
        Parameters:
        text - The text.
        font - The font.
        width - The width.
    • Method Detail

      • setMaximumLineCount

        public void setMaximumLineCount​(int maxLineCount)
        Sets the maximum Linecount
        Parameters:
        maxLineCount - Max Count of Lines
      • getMaximumLineCount

        public int getMaximumLineCount()
        Get the maximum LineCount
        Returns:
        Maximum LineCount
      • setText

        public void setText​(java.lang.String text)
        Set the Text of this Icon
        Parameters:
        text - Text in this Icon
      • setText

        public void setText​(java.io.Reader textReader)
                     throws java.io.IOException
        Set the Text of this Icon
        Parameters:
        textReader - Text in this Icon
        Throws:
        java.io.IOException - Thrown if an IO operation went wrong.
      • getIconHeight

        public int getIconHeight()
        Returns the icon's height.
        Specified by:
        getIconHeight in interface javax.swing.Icon
        Returns:
        an int specifying the fixed height of the icon.
      • getIconWidth

        public int getIconWidth()
        Returns the icon's mWidth.
        Specified by:
        getIconWidth in interface javax.swing.Icon
        Returns:
        an int specifying the fixed mWidth of the icon.
      • getLineCount

        public int getLineCount()
        Returns:
        The number of used lines.
      • paintIcon

        public void paintIcon​(java.awt.Component comp,
                              java.awt.Graphics grp,
                              int x,
                              int y)
        Draw the icon at the specified location. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.
        Specified by:
        paintIcon in interface javax.swing.Icon
      • isTextCut

        public boolean isTextCut()
        has the text in this icon been cut because it was longer than maxLines?
        Returns:
        true if the text was cut
        Since:
        3.0