Class ImageIcon

java.lang.Object
vaadinx.swing.ImageIcon
All Implemented Interfaces:
Serializable, Accessible, Icon

public class ImageIcon extends Object implements Icon, Serializable, Accessible
Emulator for ImageIcon. Holds a JDK-side ImageIcon delegate so all the load-from-file / load-from-bytes / load-from-URL / load-from-Image construction shapes Just Work, and so getImage() hands back a real Image the icon-rendering bridge can encode.

Implements Icon (paintIcon's signature references Component, which is why we can't reuse javax.swing.ImageIcon directly under D_whitelist_porting's port rule). The paintIcon body itself is a EHelper.onUnimplemented(String, String, Object...) stub — Path 3 (offscreen-paint of arbitrary Icon impls) is deferred; ImageIcon's data path is Path 1 and lives in the icon-rendering bridge, not in this class.

Construction shapes match javax.swing.ImageIcon verbatim, so post-import-swap user code (e.g. new ImageIcon("logo.png")) compiles unchanged.

See Also:
  • Constructor Details

    • ImageIcon

      public ImageIcon()
    • ImageIcon

      public ImageIcon(byte[] imageData)
    • ImageIcon

      public ImageIcon(byte[] imageData, String description)
    • ImageIcon

      public ImageIcon(Image image)
    • ImageIcon

      public ImageIcon(Image image, String description)
    • ImageIcon

      public ImageIcon(String filename)
    • ImageIcon

      public ImageIcon(String filename, String description)
    • ImageIcon

      public ImageIcon(URL location)
    • ImageIcon

      public ImageIcon(URL location, String description)
    • ImageIcon

      public ImageIcon(ImageIcon delegate)
      Adapter ctor: wrap an existing ImageIcon. Used by the icon-rendering bridge to forward the raster without re-loading from source.
  • Method Details

    • getImage

      public Image getImage()
    • setImage

      public void setImage(Image image)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getImageLoadStatus

      public int getImageLoadStatus()
    • getImageObserver

      public ImageObserver getImageObserver()
    • setImageObserver

      public void setImageObserver(ImageObserver observer)
    • 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
    • asJdk

      public ImageIcon asJdk()
      Accessor for the underlying JDK ImageIcon. The icon-rendering bridge in EHelper uses this to hand the raw raster to the surrogate-layer encoder; user code can also call it when migrating away from the vaadinx.swing.ImageIcon port back to JDK types.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible