|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--adavid.util.Bundle
Field Summary | |
static java.lang.String |
COLOR_DEF
|
static java.lang.String |
FALSE
|
static java.lang.String |
ICON_DEF
resource extensions to define how to initialise variables |
static java.lang.String |
ICON_EXT
|
static java.lang.String |
MNEMO_DEF
|
static java.lang.String |
NAME_DEF
|
static java.lang.String |
PATH_NAME
|
static java.lang.String |
STATE_DEF
|
static java.lang.String |
TEAR_DEF
|
static java.awt.MediaTracker |
tracker
|
static java.lang.String |
TRUE
|
Constructor Summary | |
Bundle(java.lang.Class target)
constructor with a class |
|
Bundle(java.util.ResourceBundle bundle)
constructor: takes the resource bundle in argument |
|
Bundle(java.lang.String bundleName,
java.lang.Class target)
constructor: takes the name of the resource bundle, and tries to locate the resource bundle |
Method Summary | |
boolean |
getBoolResource(java.lang.String def,
java.lang.String defValue)
returns the bool resource definition |
java.awt.Button |
getButton(java.lang.String name)
returns the Button corresponding the given name, use resource definitions to initialize the button |
java.awt.Checkbox |
getCheckbox(java.lang.String name)
same as getButton, for a check box |
java.awt.CheckboxMenuItem |
getCheckboxMenuItem(java.lang.String name)
same as getMenuItem, but for a check box menu item |
static java.awt.Color |
getColor(java.lang.String name,
java.awt.Color defaultColor)
returns a color by its name or by its rgb definition in hexadecimal or null in case of failure |
java.awt.Color |
getColorResource(java.lang.String def,
java.awt.Color defaultValue)
returns the color resource definition |
java.awt.Image |
getImage(java.lang.String def)
return the image with the name definition def |
java.awt.Label |
getLabel(java.lang.String name)
returns a label with its name declared in the resource file |
java.awt.Menu |
getMenu(java.lang.String name)
same as getMenuItem, but for a menu |
java.awt.MenuItem |
getMenuItem(java.lang.String name)
returns a configured menu item with the corresponding name definition |
java.lang.String |
getNameResource(java.lang.String def,
java.lang.String defaultValue)
convenient function: load a name definition |
java.awt.PopupMenu |
getPopupMenu(java.lang.String name)
return the corresponding popup menu |
java.lang.String |
getResource(java.lang.String def)
returns a resource definition or null is not found characters '_' are converted to '.' |
java.lang.String |
getResource(java.lang.String def,
java.lang.String defaultResource)
returns a resource definition or default name is not found characters '_' are converted to '.' |
java.lang.String |
getString(java.lang.String name,
java.lang.String value)
returns the corresponding string resource with the name definition for the string (the resource name) and its current value |
static java.lang.String |
iconName(java.lang.String def)
returns the corresponding default name of a resource for an icon |
void |
init(java.lang.Class dataClass)
initialization for pure static classes, no instance required |
void |
init(java.lang.Object data,
java.lang.Object actionHandler)
the initialization function called if data is not null => the class can be used only to load resources in an easy way, with no initialization |
java.awt.Image |
loadImage(java.lang.String name)
|
static java.awt.Image |
loadImageFrom(java.lang.String completeName)
easy solution: return new Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource(iconPath+name)); but java crashes sometimes: Uncaught error fetching image: java.lang.NullPointerException at java.net.URLConnection.guessContentTypeFromStream(URLConnection.java) at sun.net.www.URLConnection.getContentType(URLConnection.java:126) at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:98) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:259) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:151) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:127) so we do the job in another way: load the data and create an image from the data |
static java.lang.String |
pathName(java.lang.Class c)
give the package-superclass name as path |
static java.lang.String |
pathName(java.lang.String longName)
give the package-superclass name as path |
static java.lang.String |
pathName(java.lang.String longName,
char separator,
boolean replace)
give the path of longName, with separator as separator, replace '.' by '/' instead of File.separatorChar if the flag is set, and the path is then of the form "" or "name/name/" |
void |
setActionHandler(java.lang.Object actionHandler)
change the action handler |
void |
setIconPath(java.lang.String path)
change the icon path |
static void |
setLocation(java.awt.Frame parent,
java.awt.Window win)
position a window relative to its parent frame |
static void |
setLocation(java.awt.Window win)
sets the location of a window so that it appears in the middle of the screen |
void |
setMenuItem(java.awt.MenuItem item,
java.lang.String name,
java.lang.String def)
configure a menu item with the resource definitions |
static java.lang.String |
shortName(java.lang.Class c)
give the short name of a class |
static java.lang.String |
shortName(java.lang.String longName)
give the short name of a class name |
static java.lang.String |
shortName(java.lang.String longName,
char separator)
give the short name with separator as separator |
static void |
show(java.awt.Frame parent,
java.awt.Window win)
show a window relative to its parent frame |
static void |
show(java.awt.Window win)
set location and make a window visible |
static boolean |
waitImage(java.awt.Image img)
wait until an image is ready to use |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String ICON_DEF
public static final java.lang.String NAME_DEF
public static final java.lang.String TEAR_DEF
public static java.lang.String ICON_EXT
public static final java.lang.String TRUE
public static final java.lang.String FALSE
public static final java.lang.String MNEMO_DEF
public static final java.lang.String STATE_DEF
public static final java.lang.String COLOR_DEF
public static final java.lang.String PATH_NAME
public static final java.awt.MediaTracker tracker
Constructor Detail |
public Bundle(java.lang.Class target)
public Bundle(java.lang.String bundleName, java.lang.Class target)
public Bundle(java.util.ResourceBundle bundle)
Method Detail |
public void setActionHandler(java.lang.Object actionHandler)
public java.lang.String getResource(java.lang.String def)
public java.lang.String getResource(java.lang.String def, java.lang.String defaultResource)
public java.lang.String getNameResource(java.lang.String def, java.lang.String defaultValue)
public java.awt.Color getColorResource(java.lang.String def, java.awt.Color defaultValue)
public boolean getBoolResource(java.lang.String def, java.lang.String defValue)
public static java.lang.String shortName(java.lang.Class c)
public static java.lang.String shortName(java.lang.String longName)
public static java.lang.String shortName(java.lang.String longName, char separator)
public static java.lang.String pathName(java.lang.Class c)
public static java.lang.String pathName(java.lang.String longName)
public static java.lang.String pathName(java.lang.String longName, char separator, boolean replace)
public java.lang.String getString(java.lang.String name, java.lang.String value)
public static java.awt.Color getColor(java.lang.String name, java.awt.Color defaultColor)
public static void setLocation(java.awt.Window win)
public static void show(java.awt.Window win)
public static void setLocation(java.awt.Frame parent, java.awt.Window win)
public static void show(java.awt.Frame parent, java.awt.Window win)
public java.awt.Image getImage(java.lang.String def)
public void setIconPath(java.lang.String path)
public static java.lang.String iconName(java.lang.String def)
public static java.awt.Image loadImageFrom(java.lang.String completeName) throws java.io.IOException
public java.awt.Image loadImage(java.lang.String name)
public static boolean waitImage(java.awt.Image img)
public java.awt.Button getButton(java.lang.String name)
public java.awt.Checkbox getCheckbox(java.lang.String name)
public void setMenuItem(java.awt.MenuItem item, java.lang.String name, java.lang.String def)
public java.awt.MenuItem getMenuItem(java.lang.String name)
public java.awt.CheckboxMenuItem getCheckboxMenuItem(java.lang.String name)
public java.awt.Menu getMenu(java.lang.String name)
public java.awt.Label getLabel(java.lang.String name)
public java.awt.PopupMenu getPopupMenu(java.lang.String name)
public void init(java.lang.Object data, java.lang.Object actionHandler)
public void init(java.lang.Class dataClass)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |