|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.util.Resource
public class Resource
Cover for fetching files using Class.getResource(). If the application is started from a jar file, then it looks in there. If the application is started from a class file, then it looks in the disk file heirarchy, using directories in the classpath as root(s). 1. Filenames. use "/" as path seperator when embedded in a string. This works on both Windows and Unix. 2. Filepath. Use a resourcePath starting with a forward slash. getResource() then searches relative to the classpath. otherwise it will search reletive to ucar.unidata.util, which is probably not what you want.
| Constructor Summary | |
|---|---|
Resource()
|
|
| Method Summary | |
|---|---|
static InputStream |
getFileResource(String resourcePath,
String fileName)
Open a resource as a Stream. |
static ImageIcon |
getIcon(String fullIconName,
boolean errMsg)
Get a gif file, make it into an ImageIcon. |
static Image |
getImage(String fullImageName)
Get a gif file, make it into an Image. |
static ImageIcon |
getImageIcon(String fullImageName)
Get a gif file, make it into an ImageIcon. |
static URL |
getURL(String filename)
Get a file as a URL |
static void |
main(String[] args)
testing |
static Cursor |
makeCursor(String name)
Get a gif file, make it into a Cursor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Resource()
| Method Detail |
|---|
public static ImageIcon getIcon(String fullIconName,
boolean errMsg)
fullIconName - full path name of gif file (use forward slashes!)errMsg - print err message on failure
public static Image getImage(String fullImageName)
fullImageName - full path name of gif file (use forward slashes!)
public static ImageIcon getImageIcon(String fullImageName)
fullImageName - full path name of gif file (use forward slashes!)
public static URL getURL(String filename)
filename - full path name of file (use forward slashes!)
public static Cursor makeCursor(String name)
name - full path name of gif file (use forward slashes!)
public static InputStream getFileResource(String resourcePath,
String fileName)
resourcePath - name of file path (use forward slashes!)fileName - name of file (use forward slashes!)
public static void main(String[] args)
args -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||