Package mars.venus
Class SVGIcon
java.lang.Object
mars.venus.SVGIcon
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet the icon's height.intGet the icon's width.voidDraw the icon at the specified location.voidsetIconDimensions(int width, int height) Set the icon's image dimensions.
-
Constructor Details
-
SVGIcon
Create a newSVGIconfrom 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:
getIconWidthin interfaceIcon- Returns:
- An int specifying the width of the icon.
-
getIconHeight
public int getIconHeight()Get the icon's height.- Specified by:
getIconHeightin interfaceIcon- 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
Draw the icon at the specified location.
-