Class SwingIcon
java.lang.Object
com.jformdesigner.model.SwingIcon
- All Implemented Interfaces:
SwingResource, Icon
Used to specify a
Icon.
The icon is either loaded from the classpath using
new ImageIcon(classLoader.getResource(name)),
from the file system using new ImageIcon(name)
or from the current look and feel using UIManager.getIcon(name).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateIcon(ClassLoader loader) For internal use only.booleanDetermines whether another object is equal to this object.intReturns the custom SVG icon height.intintgetName()Returns the icon name.floatgetScale()Returns the amount by which the SVG icon size is scaled.intgetType()intgetWidth()Returns the custom SVG icon width.inthashCode()Returns the hash code for this object.voidtoString()Returns a string representation of the object.
-
Field Details
-
CLASSPATH
public static final int CLASSPATH- See Also:
-
FILE
public static final int FILE- See Also:
-
SWING
public static final int SWING- Since:
- 3.0
- See Also:
-
-
Constructor Details
-
SwingIcon
Constructs a icon.- Parameters:
type- The icon type (CLASSPATH,FILEorSWING).name- The icon name. A resource name (seejava.lang.ClassLoader.getResource(String)) if type isCLASSPATH, a file name (seejavax.swing.ImageIcon(String)) if type isFILEor a key (seejavax.swing.UIManager.getIcon(String)) if type isSWING.
-
SwingIcon
Constructs a icon including SVG icon options.- Parameters:
type- The icon type (CLASSPATH,FILEorSWING).name- The icon name. A resource name (seejava.lang.ClassLoader.getResource(String)) if type isCLASSPATH, a file name (seejavax.swing.ImageIcon(String)) if type isFILEor a key (seejavax.swing.UIManager.getIcon(String)) if type isSWING.width- Custom SVG icon width, or-1.height- Custom SVG icon height, or-1.scale- Custom SVG icon scale factor, or1.- Since:
- 8.3
-
SwingIcon
public SwingIcon(int type, String name, int width, int height, float scale, Color fromColor, Color toLightColor, Color toDarkColor) Constructs a icon including SVG icon options.- Parameters:
type- The icon type (CLASSPATH,FILEorSWING).name- The icon name. A resource name (seejava.lang.ClassLoader.getResource(String)) if type isCLASSPATH, a file name (seejavax.swing.ImageIcon(String)) if type isFILEor a key (seejavax.swing.UIManager.getIcon(String)) if type isSWING.width- Custom SVG icon width, or-1.height- Custom SVG icon height, or-1.scale- Custom SVG icon scale factor, or1.fromColor- Custom SVG icon color that is mapped totoLightColorortoDarkColor, ornull. Ifnull, all colors in the SVG are mapped.toLightColor- Custom SVG icon color for light themes, ornull.toDarkColor- Custom SVG icon color for dark themes, ornull. Ifnull,toLightColoris used.- Since:
- 8.3
-
-
Method Details
-
getType
-
getName
-
getWidth
public int getWidth()Returns the custom SVG icon width. Or-1to use default width specified in SVG icon.- Since:
- 8.3
-
getHeight
public int getHeight()Returns the custom SVG icon height. Or-1to use default height specified in SVG icon.- Since:
- 8.3
-
getScale
public float getScale()Returns the amount by which the SVG icon size is scaled. Usually1.- Since:
- 8.3
-
getFromColor
-
getToLightColor
-
getToDarkColor
-
createIcon
For internal use only. -
getIconWidth
public int getIconWidth()- Specified by:
getIconWidthin interfaceIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeightin interfaceIcon
-
paintIcon
-
equals
-
hashCode
-
toString
-