Package mars.venus

Class SVGIcon

java.lang.Object
mars.venus.SVGIcon
All Implemented Interfaces:
Icon

public class SVGIcon extends Object implements Icon
An icon whose image is in the Scalable Vector Graphics format. Since it is a vector image, this icon can be resized, despite the Icon interface being defined to represent a "small fixed size picture."
  • Constructor Details

    • SVGIcon

      public SVGIcon(URL url, int width, int height)
      Create a new SVGIcon from a URL and initial dimensions.
      Parameters:
      url - The URL for the icon image.
      width - The initial width of the icon.
      height - The initial height of the icon.
  • Method Details

    • getIconWidth

      public int getIconWidth()
      Get the icon's width.
      Specified by:
      getIconWidth in interface Icon
      Returns:
      An int specifying the width of the icon.
    • getIconHeight

      public int getIconHeight()
      Get the icon's height.
      Specified by:
      getIconHeight in interface Icon
      Returns:
      An int specifying the height of the icon.
    • setIconDimensions

      public void setIconDimensions(int width, int height)
      Set the icon's image dimensions. Note that this reloads the image.
      Parameters:
      width - The new width of the icon.
      height - The new height of the icon.
    • paintIcon

      public void paintIcon(Component component, Graphics graphics, int leftX, int topY)
      Draw the icon at the specified location.
      Specified by:
      paintIcon in interface Icon
      Parameters:
      component - A Component to get properties useful for painting (not used).
      graphics - The graphics context.
      leftX - The X coordinate of the icon's top-left corner.
      topY - The Y coordinate of the icon's top-left corner.