Class StringIcon

  • All Implemented Interfaces:
    javax.swing.Icon

    public class StringIcon
    extends java.lang.Object
    implements javax.swing.Icon
    The class StringIcon creates an icon with the given text
    • Constructor Summary

      Constructors 
      Constructor Description
      StringIcon​(@NonNull javax.swing.JComponent component, @NonNull java.lang.String text, java.awt.Font font, java.awt.Color foreground)
      Instantiates a new StringIcon object
      StringIcon​(javax.swing.JComponent component, java.lang.String text)
      Instantiates a new StringIcon object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIconHeight()
      int getIconWidth()
      void paintIcon​(java.awt.Component component, java.awt.Graphics graphics, int x, int y)
      • Methods inherited from class java.lang.Object

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

      • StringIcon

        public StringIcon​(javax.swing.JComponent component,
                          java.lang.String text)
        Instantiates a new StringIcon object
        Parameters:
        component - the component
        text - the text
      • StringIcon

        public StringIcon​(@NonNull
                          @NonNull javax.swing.JComponent component,
                          @NonNull
                          @NonNull java.lang.String text,
                          java.awt.Font font,
                          java.awt.Color foreground)
        Instantiates a new StringIcon object
        Parameters:
        component - the component
        text - the text
        font - the font
        foreground - the foreground
    • Method Detail

      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
      • paintIcon

        public void paintIcon​(java.awt.Component component,
                              java.awt.Graphics graphics,
                              int x,
                              int y)
        Specified by:
        paintIcon in interface javax.swing.Icon