public class SwingDecoratorFunctionality extends Object
myButton.text=Hello
myButton.tooltip=just an example
myButton.icon=myImage
The code to initialize the button would be something like:
JButton b= new JButton();
b.setName("button");
SwingDecorator.initilize(b, "myButton");
Modifier and Type | Class and Description |
---|---|
static class |
SwingDecoratorFunctionality.MultiResourceBundle
Helper class to support multiple ResourceBundles.
|
Constructor and Description |
---|
SwingDecoratorFunctionality()
Standard constructor.
|
SwingDecoratorFunctionality(boolean pEnforceSet,
IconCache pIconCache)
A public constructor for use in
SwingXMLBuilder . |
Modifier and Type | Method and Description |
---|---|
void |
addBundle(ResourceBundle pResourceBundle)
Adds all non-null String key/value pairs of a bundle to
the SwingDecorator singleton.
|
void |
addBundle(String pBaseName)
Adds a property file to SwingDecorator, see ResourceBundle.getBundle() for
the details how the property file is found.
|
KeyStroke |
getAccelerator(String pI18nID)
Returns null or a accelerator KeyStroke for the handed key.
|
Icon |
getIcon(String pI18nID)
Returns the normal Icon for the handed key or null.
|
ImageIcon |
getIcon(String pI18nID,
String pIconModifier)
Loads an Icon for the handed key and modifier.
|
Character |
getMnemonic(String pI18nID)
Returns null or a Character that is the mnemonic for the handed key.
|
String |
getText(String pI18nID)
Returns the I18n text matching the handed key.
|
String |
getText(String pI18nID,
Object[] pParams)
Returns the I18n text matching the handed key and parameters.
|
String |
getTitle(String pI18nID)
Returns the I18n title matching the handed key.
|
String |
getTitle(String pI18nID,
Object[] pParams)
Returns the I18n title matching the handed key and parameters.
|
String |
getToolTip(String pI18nID,
Object[] pParams)
Returns the I18n tool tip matching the handed key and parameters.
|
void |
initialize(Action pAction,
String pI18nID)
Decorates an action by an I18n key.
|
void |
initialize(Component pComponent,
String pI18nID)
Decorates a widget by an I18n key.
|
void |
initialize(Component pComponent,
String pI18nID,
Object[] pParams)
Decorates a widget by an I18n key.
|
public SwingDecoratorFunctionality()
public SwingDecoratorFunctionality(boolean pEnforceSet, IconCache pIconCache)
SwingXMLBuilder
.pEnforceSet
- flag if getString() is to always return a real string
(and not null
)pIconCache
- icon cache (may be null
)public void addBundle(String pBaseName)
pBaseName
- base name of the resource bundlepublic void addBundle(ResourceBundle pResourceBundle)
pResourceBundle
- the resource bundle to add, must not be nullpublic String getText(String pI18nID)
pI18nID
- I18n keypublic String getText(String pI18nID, Object[] pParams)
pI18nID
- I18n keypParams
- parameters for the messagepublic String getToolTip(String pI18nID, Object[] pParams)
pI18nID
- I18n keypParams
- parameters for the messagepublic String getTitle(String pI18nID)
pI18nID
- I18n keypublic String getTitle(String pI18nID, Object[] pParams)
pI18nID
- I18n keypParams
- parameters for the messagepublic Character getMnemonic(String pI18nID)
pI18nID
- I18n keypublic KeyStroke getAccelerator(String pI18nID)
pI18nID
- I18n keypublic Icon getIcon(String pI18nID)
pI18nID
- I18n keypublic ImageIcon getIcon(String pI18nID, String pIconModifier)
pI18nID
- I18n keypIconModifier
- modifier for the icon namepublic void initialize(Action pAction, String pI18nID)
pAction
- the action to be initialisedpI18nID
- I18n keypublic void initialize(Component pComponent, String pI18nID)
pComponent
- das Widget, das initialisiert werden sollpI18nID
- I18n keyCopyright © 2017 Jürgen Zeller (privat). All rights reserved.