Class ScaledImageIcon

  • All Implemented Interfaces:
    javax.swing.Icon
    Direct Known Subclasses:
    FlatTitlePaneIcon

    public class ScaledImageIcon
    extends java.lang.Object
    implements javax.swing.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 Summary

      Constructors 
      Constructor Description
      ScaledImageIcon​(javax.swing.ImageIcon imageIcon)  
      ScaledImageIcon​(javax.swing.ImageIcon imageIcon, int iconWidth, int iconHeight)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIconHeight()  
      int getIconWidth()  
      protected java.awt.Image getResolutionVariant​(int destImageWidth, int destImageHeight)  
      void paintIcon​(java.awt.Component c, java.awt.Graphics g, int x, int y)  
      • Methods inherited from class java.lang.Object

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

      • ScaledImageIcon

        public ScaledImageIcon​(javax.swing.ImageIcon imageIcon)
      • ScaledImageIcon

        public ScaledImageIcon​(javax.swing.ImageIcon imageIcon,
                               int iconWidth,
                               int iconHeight)
    • Method Detail

      • getIconWidth

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

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

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Specified by:
        paintIcon in interface javax.swing.Icon
      • getResolutionVariant

        protected java.awt.Image getResolutionVariant​(int destImageWidth,
                                                      int destImageHeight)