Module tvbrowser
Package util.ui

Class FixedSizeIcon

  • All Implemented Interfaces:
    javax.swing.Icon

    public class FixedSizeIcon
    extends java.lang.Object
    implements javax.swing.Icon
    An icon having a fixed size. This icon wrappes a nested icon. If the nested Icon is smaller than the defined size, it will be shown in the center of this icon (The nested icon will get a transparent border).
    Author:
    Til Schneider, www.murfman.de
    See Also:
    Plugin.getButtonAction()
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedSizeIcon​(int width, int height, javax.swing.Icon nestedIcon)
      Creates a new instance of FixedSizeIcon.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIconHeight()
      Gets the icon's height.
      int getIconWidth()
      Gets the icon's width.
      void paintIcon​(java.awt.Component c, java.awt.Graphics g, int x, int y)
      Paints the icon.
      • Methods inherited from class java.lang.Object

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

      • FixedSizeIcon

        public FixedSizeIcon​(int width,
                             int height,
                             javax.swing.Icon nestedIcon)
        Creates a new instance of FixedSizeIcon.
        Parameters:
        width - The width the icon should have.
        height - The height the icon should have.
        nestedIcon - The nested icon to show.
    • Method Detail

      • getIconWidth

        public int getIconWidth()
        Gets the icon's width.
        Specified by:
        getIconWidth in interface javax.swing.Icon
        Returns:
        the icon's width
      • getIconHeight

        public int getIconHeight()
        Gets the icon's height.
        Specified by:
        getIconHeight in interface javax.swing.Icon
        Returns:
        the icon's height
      • paintIcon

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Paints the icon.
        Specified by:
        paintIcon in interface javax.swing.Icon
        Parameters:
        c - May be used to get properties useful for painting, e.g. the foreground or background color.
        g - The graphics context to paint to.
        x - The x position where to paint the icon
        y - The y position where to paint the icon