public class SwingIcon extends Object implements Icon, SwingResource
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)
.Modifier and Type | Field and Description |
---|---|
static int |
CLASSPATH |
static int |
FILE |
static int |
SWING |
Constructor and Description |
---|
SwingIcon(int type,
String name)
Constructs a icon.
|
Modifier and Type | Method and Description |
---|---|
Icon |
createIcon(ClassLoader loader)
For internal use only.
|
boolean |
equals(Object obj)
Determines whether another object is equal to this object.
|
int |
getIconHeight() |
int |
getIconWidth() |
String |
getName()
Returns the icon name.
|
int |
getType()
|
int |
hashCode()
Returns the hash code for this object.
|
void |
paintIcon(Component c,
Graphics g,
int x,
int y) |
String |
toString()
Returns a string representation of the object.
|
public static final int CLASSPATH
public static final int FILE
public static final int SWING
public SwingIcon(int type, String name)
type
- The icon type (CLASSPATH
, FILE
or SWING
).name
- The icon name.
A resource name (see java.lang.ClassLoader.getResource(String)
)
if type is CLASSPATH
, a file name (see javax.swing.ImageIcon(String)
)
if type is FILE
or a key (see javax.swing.UIManager.getIcon(String)
)
if type is SWING
.public int getType()
public String getName()
public Icon createIcon(ClassLoader loader)
public int getIconWidth()
getIconWidth
in interface Icon
public int getIconHeight()
getIconHeight
in interface Icon
public boolean equals(Object obj)
public int hashCode()
Copyright (C) 2004-2019 FormDev Software GmbH. All rights reserved.