|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPIRL.Viewers.Icons
public class Icons
The Icons class provides static methods to load ImageIcons.
Field Summary | |
---|---|
static String |
DEFAULT_ICON_DIRECTORY_NAME
|
static String |
ID
|
Method Summary | |
---|---|
static Class |
Class_Relative()
Gets the Class to which the current directory
is relative. |
static String |
Directory()
Gets the pathname of the directory where icon image files are to be found. |
static String |
Directory(String directory_path)
Sets the name of the directory where icon image files are to be found. |
static String |
Directory(String directory_path,
Class the_class)
Sets the name of the directory where icon image files may be found relative to the location of a class. |
static ImageIcon |
Load_Icon(String source)
Loads an ImageIcon from a source. |
static void |
main(String[] arguments)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String DEFAULT_ICON_DIRECTORY_NAME
Method Detail |
---|
public static ImageIcon Load_Icon(String source)
If the source is null or the empty String, nothing is done and null is returned.
First, an attempt is made to construct a URL from the source String. If this succeeds the URL is used to try and load an ImageIcon. No other attempts are made to find the source.
Next the source is treated as a file pathname. If this pathname is
absolute or the source is not class-relative
an attempt will be made to load an ImageIcon from the
pathname. If the pathname is relative it is prepended with the icon
directory
or class-relative directory
pathname, whichever is current. If
the resultant pathname is for a normal file (rather than a directory)
and read access is permitted by any existing security manager the
pathname is used to try and load an ImageIcon.
If an ImageIcon is not yet loaded the pathname from the previous attempt is used to try and locate a system resource. This resource may be found relative to the CLASSPATH or inside a jar file. If this succeeds in producing a URL it is used to try and load an ImageIcon.
source
- The URL or pathname for the icon image source.
public static String Directory(String directory_path)
N.B.: The directory pathname is marked as being not class-relative
.
directory_path
- The pathname for the directory. If null or empty
the DEFAULT_ICON_DIRECTORY_NAME
will be used.
public static String Directory(String directory_path, Class the_class)
If the directory name is null or empty the DEFAULT_ICON_DIRECTORY_NAME
will be used. If the directory name is
an absolute pathname, the class location is not used. Otherwise the
directory pathname to the class location is prepended to the
directory name and the resultant directory
pathname
is marked as being class-relative
.
directory_path
- The pathname for the icons directory. If
this is a relative pathname it will be relative to the location
of the class.the_class
- The Class location to use as the base for a
relative directory pathname. Ignored if null.
public static Class Class_Relative()
directory
is relative.
class-relative
directory pathname. This will be null if the
current directory pathname
is not
class-relative.public static String Directory()
public static void main(String[] arguments)
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |