Re: SelectedIcon not localized
Lutz Neumann <[email protected]>
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Organization | Softronix GmbH |
| Message-ID | <[email protected]> |
am Mittwoch, 24. März 2004, 18:31:08, schrieben Sie:
> This sounds like a reasonable and quite small enhancement to me.
> The field remains "public static" and its "final" modifier gets
> removed. Then you are able to add or remove attributes
> at your own risk...
There is no need to remove the final modifier. I don't want to replace
the Vector, just add some elements to it - and this is possible even
if it's declared final.
> Lutz, perhaps you could remove the modifier yourself
> and look for any ill effects?
> Frank
Ok, I added the two following static methods to SwingEngine.java:
/**
* Adds a String to the SwingEngine's global localizer attribute table, to be used by all SwingEngine instances.
* Strings found in this table are candidates for localization and will be looked up in the resource bundle.
*
* @param attribute <code>String</code> the attribute to localize.
*/
public static void addLocalizableAttribute(String attribute)
{
if (Parser.LOCALIZED_ATTRIBUTES.contains(attribute.toLowerCase()) == false)
Parser.LOCALIZED_ATTRIBUTES.add(attribute.toLowerCase());
}
/**
* Removes a String to the SwingEngine's global localizer attribute table, to be used by all SwingEngine instances.
* Strings found in this table are candidates for localization and will be looked up in the resource bundle.
*
* @param attribute <code>String</code> the attribute to localize.
*/
public static void removeLocalizableAttribute(String attribute)
{
Parser.LOCALIZED_ATTRIBUTES.remove(attribute.toLowerCase());
}
and a call to the add method in my app:
SwingEngine.addLocalizableAttribute("selectedicon");
Works without problems as far as I can see.
Besides this I would recommend to add the standard attributes
SelectedIcon, DisabledIcon, DisabledSelectedIcon, PressedIcon,
RolloverIcon and RolloverSelectedIcon to the "default"
LOCALIZED_ATTRIBUTES Vector - only fair if Icon is already added ;-)
- Lutz