Class ScaledImageIcon

java.lang.Object
com.formdev.flatlaf.util.ScaledImageIcon
All Implemented Interfaces:
Icon
Direct Known Subclasses:
FlatTitlePaneIcon

public class ScaledImageIcon extends Object implements Icon
Scales the given image icon using the system and user scale factors and paints the icon at system scale factor 1x. This gives best scaling quality. If the given image icon supports multiple resolutions, the best resolution variant is used. The last scaled image is cached for faster repainting.
  • Constructor Details

    • ScaledImageIcon

      public ScaledImageIcon(ImageIcon imageIcon)
    • ScaledImageIcon

      public ScaledImageIcon(ImageIcon imageIcon, int iconWidth, int iconHeight)
  • Method Details

    • getIconWidth

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

      public int getIconHeight()
      Specified by:
      getIconHeight in interface Icon
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Specified by:
      paintIcon in interface Icon
    • getResolutionVariant

      protected Image getResolutionVariant(int destImageWidth, int destImageHeight)