Class Win32ResourceDecoder
public class Win32ResourceDecoder extends ResourceDecoder
{
// Fields
public final static int RT_ACCELERATOR;
public final static int RT_ANICURSOR;
public final static int RT_ANIICON;
public final static int RT_BITMAP;
public final static int RT_CURSOR;
public final static int RT_DIALOG;
public final static int RT_DLGINCLUDE;
public final static int RT_FONT;
public final static int RT_FONTDIR;
public final static int RT_GROUP_CURSOR;
public final static int RT_GROUP_ICON;
public final static int RT_ICON;
public final static int RT_MENU;
public final static int RT_MESSAGETABLE;
public final static int RT_NAMEDTYPE;
public final static int RT_NONE;
public final static int RT_PLUGPLAY;
public final static int RT_RCDATA;
public final static int RT_STRING;
public final static int RT_VERSION;
public final static int RT_VXD;
// Constructors
public Win32ResourceDecoder();
public Win32ResourceDecoder(String filename)
throws FileNotFoundException;
public Win32ResourceDecoder(InputStream is)
throws FileNotFoundException;
// Methods
public void enumerateResources(ResourceTypeListener rtl)
throws ResourceFormattingException;
public synchronized void enumerateResources(
ResourceTypeListener rtl, int lang, int type)
throws ResourceFormattingException;
public byte[] getBytes(int type, int id)
throws ResourceFormattingException;
public byte[] getBytes(int type, String name)
throws ResourceFormattingException;
public char[] getChars(int type, int id)
throws ResourceFormattingException;
public char[] getChars(int type, int id, int lang)
throws ResourceFormattingException;
public UIDialog getDialog(int dlgId)
throws ResourceFormattingException;
public UIDialog getDialog(String dlgname)
throws ResourceFormattingException;
public UIBand getMenu(int menuId)
throws ResourceFormattingException;
public UIBand getMenu(int menuId, int lang)
throws ResourceFormattingException;
public UIBand getMenu(String menuname,
UIMenuList menuList) throws ResourceFormattingException;
public UIBand getMenu(String menuname, UIMenuList menuList,
int lang) throws ResourceFormattingException;
public UIBand getMenu(String menuname)
throws ResourceFormattingException;
public String getString(int strId)
throws ResourceFormattingException;
public String getString(int strId, int lang)
throws ResourceFormattingException;
public void populateDialog(UIDialog dlg, int dlgId, int language)
throws ResourceFormattingException;
public void populateDialog(UIDialog dlg, int dlgId)
throws ResourceFormattingException;
public void populateDialog(UIDialog dlg, String dlgname,
int language) throws ResourceFormattingException;
public void populateDialog(UIDialog dlg, String dlgname)
throws ResourceFormattingException;
public UIBand populateMenu(int menuId,
UIMenuList menuList) throws ResourceFormattingException;
public UIBand populateMenu(int menuId, UIMenuList menuList,
int lang) throws ResourceFormattingException;
public void setLocale(int locale);
}
This class is used to utilize Microsoft® Win32® resource (.res) files. This class is provided to help developers maximize any investment they have already made in Win32 resources for Microsoft® Windows® applications by being able to use the same resources files in their Java applications and applets.
Resource files are particularly useful for localizing content, because the user interface (UI) elements or resources can be maintained in a separate file and localized apart from the source code. These resources are referenced either by name or resource identifier by this class and instantiated in the Java applet or application.
ResourceDecoder
|
+--Win32ResourceDecoder
public Win32ResourceDecoder();
Creates an empty Win32 resource (.res) decoder.
public Win32ResourceDecoder(String filename) throws FileNotFoundException;
Creates a Win32 resource (.res) decoder based on the file specified.
Parameter | Description |
filename
| The file containing the resources.
|
Exceptions:
FileNotFoundException
if the filename is invalid or the file is not found.
public Win32ResourceDecoder(InputStream is) throws FileNotFoundException;
Creates a Win32 resource (.res) decoder based on a byte input stream.
Parameter | Description |
is
| The InputStream object the decoder is based on.
|
Exceptions:
FileNotFoundException
if the filename is invalid or the file is not found.
See Also: com.ms.ui.resource.ResourceDecoder
public void enumerateResources(ResourceTypeListener rtl)
throws ResourceFormattingException;
Enumerates all the resources in the file back to the application.
Return Value:
No return value.
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if there is no string buffer, or if the string buffer name is invalid.
public synchronized void enumerateResources(ResourceTypeListener rtl,
int lang, int type) throws ResourceFormattingException;
Enumerates all resources, conforming to the language, specified back to the application.
Return Value:
No return value.
Parameter | Description |
rtl
| The resource type listener.
|
lang
| The language of resources to enumerate.
|
type
| The type of resources to enumerate. Currently, this parameter is not used to enumerate resources.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if there is no string buffer, or the string buffer name is invalid.
public byte[] getBytes(int type, int id) throws ResourceFormattingException;
Retrieves a byte block of the resource type specified, with the given identifier.
Return Value:
Returns the requested byte array.
Parameter | Description |
type
| The resource type of the byte block.
|
id
| The string identifier of the byte block.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the resource identifier is invalid.
public byte[] getBytes(int type, String name)
throws ResourceFormattingException;
Retrieves a byte block, of the resource type specified, with the given name.
Return Value:
Returns the requested byte array.
Parameter | Description |
type
| The resource type of the byte block.
|
name
| The resource name of the byte block.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the resource identifier is invalid.
public char[] getChars(int type, int id) throws ResourceFormattingException;
Retrieves a character array of the resource type specified with the given identifier. The RT_RCDATA resource format stores data in words, so use the getChars method when reading data in this format.
Return Value:
Returns the requested character array.
Parameter | Description |
type
| The resource type of the character block.
|
id
| The identifier of the character block.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the resource identifier is invalid.
public char[] getChars(int type, int id, int lang)
throws ResourceFormattingException;
Retrieves a character array of the resource type specified with the given identifier. The RT_RCDATA resource format stores data in words, so use the getChars method when reading data in this format.
Return Value:
Returns the requested character array.
Parameter | Description |
type
| The resource type of the character block.
|
id
| The identifier of the character block.
|
lang
| The language of the resource type. Currently, this parameter is not used to retrieve the character array.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the resource identifier is invalid.
public UIDialog getDialog(int dlgId) throws ResourceFormattingException;
Retrieves a dialog box, in the current locale, with the specified dialog identifier.
Return Value:
Returns the dialog box requested.
Parameter | Description |
dlgId
| The identifier of the dialog resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified dialog identifier is not valid.
public UIDialog getDialog(String dlgname)
throws ResourceFormattingException;
Retrieves a dialog box, in the current locale, with the specified name.
Return Value:
Returns the dialog box requested.
Parameter | Description |
dlgname
| The name of the dialog resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified dialog name is not valid.
public UIBand getMenu(int menuId) throws ResourceFormattingException;
Retrieves a menu, in the current locale, with the specified menu identifier.
Return Value:
Returns a UIBand menu object.
Parameter | Description |
menuId
| The menu identifier.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified menu identifier is not valid.
public UIBand getMenu(int menuId, int lang)
throws ResourceFormattingException;
Retrieves a menu with the specified menu identifier.
Return Value:
Returns a UIBand menu object.
Parameter | Description |
menuId
| The menu identifier.
|
lang
| The language of the menu resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified menu identifier is not valid.
public UIBand getMenu(String menuname, UIMenuList menuList)
throws ResourceFormattingException;
Retrieves a filled menu, in the current locale, with the specified menu name.
Return Value:
Returns a UIBand menu object.
Parameter | Description |
menuname
| The name of the menu.
|
menuList
| The list to fill the menu with.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified menu name is not valid.
public UIBand getMenu(String menuname, UIMenuList menuList,
int lang) throws ResourceFormattingException;
Retrieves a filled menu with the specified menu name.
Return Value:
Returns a UIBand menu object.
Parameter | Description |
menuname
| The name of the menu.
|
menuList
| The list to populate the menu object with.
|
lang
| The language of the resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified menu name is not valid.
public UIBand getMenu(String menuname) throws ResourceFormattingException;
Retrieves a menu, in the current locale, with the specified menu name.
Return Value:
Returns a UIBand menu object.
Parameter | Description |
menuname
| The name of the menu.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified menu name is not valid.
public String getString(int strId) throws ResourceFormattingException;
Retrieves a string resource, in the current locale, with the specified string identifier.
Return Value:
Returns the requested string resource.
Parameter | Description |
strId
| The identifier of the string resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified string identifier is not valid.
public String getString(int strId, int lang)
throws ResourceFormattingException;
Retrieves a string resource with the specified string identifier.
Return Value:
Returns the requested string resource.
Parameter | Description |
strId
| The identifier of the string resource.
|
lang
| The language of the string resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified string identifier is not valid.
public void populateDialog(UIDialog dlg, int dlgId, int language)
throws ResourceFormattingException;
Fills an existing dialog box with the specified identifier with the data and/or controls as specified in the resource. This is useful for classes that are derived from UIDialog.
Return Value:
No return value.
Parameter | Description |
dlg
| The dialog object to populate.
|
dlgId
| The identifier of the dialog resource containing the components.
|
language
| The language of the resources.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified dialog identifier is not valid.
public void populateDialog(UIDialog dlg, int dlgId)
throws ResourceFormattingException;
Fills an existing dialog box, in the current locale, with the specified identifier with the data or controls, or both, as specified in the resource. This is useful for classes that are derived from UIDialog.
Return Value:
No return value.
Parameter | Description |
dlg
| The dialog object to populate.
|
dlgId
| The identifier of the dialog resource containing the components.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified dialog identifier is not valid.
public void populateDialog(UIDialog dlg, String dlgname,
int language) throws ResourceFormattingException;
Fills an existing dialog box with the specified name with the data or controls, or both, as specified in the resource. This is useful for classes that are derived from UIDialog.
Return Value:
No return value.
Parameter | Description |
dlg
| The dialog object to populate.
|
dlgname
| The name of the dialog resource containing the components.
|
language
| The language of the resources.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified dialog name is not valid.
public void populateDialog(UIDialog dlg, String dlgname)
throws ResourceFormattingException;
Fills an existing dialog box, in the current locale, with the specified name with the data or controls, or both, as specified in the resource. This is useful for classes that are derived from UIDialog.
Return Value:
No return value.
Parameter | Description |
dlg
| The dialog object to populate.
|
dlgname
| The name of the dialog resource containing the components.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified dialog name is not valid.
public UIBand populateMenu(int menuId, UIMenuList menuList)
throws ResourceFormattingException;
Populates the specified menu.
Return Value:
Returns a populated UIBand menu object.
Parameter | Description |
menuId
| The menu identifier.
|
menuList
| The list to fill the menu with.
|
public UIBand populateMenu(int menuId, UIMenuList menuList,
int lang) throws ResourceFormattingException;
Retrieves a menu with the specified menu identifier.
Return Value:
Returns a populated UIBand menu object.
Parameter | Description |
menuId
| The menu identifier.
|
menuList
| The list to fill the menu with.
|
lang
| The language of the menu resource.
|
Exceptions:
com.ms.ui.resource.ResourceFormattingException
if the specified menu identifier is not valid.
public void setLocale(int locale);
Sets the current locale. Currently, this method accepts a system LCID value (not a java.util.Locale constant) for the Microsoft Win32 VM for Java.
Return Value:
No return value.
Parameter | Description |
locale
| The locale to be set.
|
See Also: java.util.Locale, java.util.Locale.getLCID, com.ms.fx.IFxSystemInterface.getSystemLCID
- RT_ACCELERATOR
- An accelerator (or keyboard shortcut, hotkey) table resource type.
- RT_ANICURSOR
- An animated cursor resource type.
- RT_ANIICON
- An animated icon resource type.
- RT_BITMAP
- A bitmap resource type.
- RT_CURSOR
- A hardware-dependent cursor resource type.
- RT_DIALOG
- A dialog resource type.
- RT_DLGINCLUDE
- RT_FONT
- A font resource type.
- RT_FONTDIR
- A font directory resource type.
- RT_GROUP_CURSOR
- A hardware-independent cursor resource type.
- RT_GROUP_ICON
- A hardware-independent group icon resource type.
- RT_ICON
- A hardware-dependent icon resource type.
- RT_MENU
- A menu resource type.
- RT_MESSAGETABLE
- A message table entry resource type.
- RT_NAMEDTYPE
- RT_NONE
- There is no specified resource type.
- RT_PLUGPLAY
- A Plug-and-Play resource type.
- RT_RCDATA
- A raw data resource type. Raw data resources permit the inclusion of binary data directly in the executable file.
- RT_STRING
- A string resource type.
- RT_VERSION
- A version stamp resource type.
- RT_VXD
- A virtual device driver resource type.