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 TypeMethodDescriptionint
Get the icon's height.int
Get the icon's width.void
Draw the icon at the specified location.void
setIconDimensions
(int width, int height) Set the icon's image dimensions.
-
Constructor Details
-
SVGIcon
Create a newSVGIcon
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 interfaceIcon
- Returns:
- An int specifying the width of the icon.
-
getIconHeight
public int getIconHeight()Get the icon's height.- Specified by:
getIconHeight
in 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.
-