JColorchooser - Locale

W

widebull

On application startup I set a different locale from JVM.

JColorChooser show strings in JVM default locale.


How can set the right language in JColorChooser whitout change dhe
default JVM language?

thanks
 
T

Thomas Hawtin

widebull said:
On application startup I set a different locale from JVM.

JColorChooser show strings in JVM default locale.


How can set the right language in JColorChooser whitout change dhe
default JVM language?

Presumably calling setLocale on it should work. Or calling
JComponent.setDefaultLocale on application start up.

Tom hawtin
 
W

widebull

Sembra che Thomas Hawtin abbia detto :
JComponent.setDefaultLocale on application start up.

I have tryed but no result.

I have also tryed this

com.borland.dbswing.IntlSwingSupport support = new
com.borland.dbswing.IntlSwingSupport(Locale.ENGLISH);

whith no result.
 
T

Thomas Hawtin

widebull said:
Sembra che Thomas Hawtin abbia detto :

I have tryed but no result.

A quick look at the source seems to indicate that the chooser locale
will only affect the preview title border.

From ColorChooserDialog API docs in JColorChooser.java:

" * Note: This needs to be fixed to deal with localization!"

Looking further, in UIDefaults we have the line:

private Locale defaultLocale = Locale.getDefault();

That's the wrong default. However, you should be able to change it with:

UIManager.getDefaults().setDefaultLocale(locale);

Tom Hawtin
 
T

Thomas Weidenfeller

widebull said:
How can set the right language in JColorChooser whitout change dhe
default JVM language?

If everything else fails, assign the following individual UIDefaults
keys new string values via the UIManager:

ColorChooser.cancelText
ColorChooser.hsbBlueText
ColorChooser.hsbBrightnessText
ColorChooser.hsbGreenText
ColorChooser.hsbHueText
ColorChooser.hsbNameText
ColorChooser.hsbRedText
ColorChooser.hsbSaturationText
ColorChooser.okText
ColorChooser.previewText
ColorChooser.resetText
ColorChooser.rgbBlueText
ColorChooser.rgbGreenText
ColorChooser.rgbRedText
ColorChooser.nameText
ColorChooser.swatchesNameText
ColorChooser.swatchesRecentText

And assign matching mnemonic values (integers) to

ColorChooser.rgbBlueMnemonic
ColorChooser.rgbGreenMnemonic
ColorChooser.rgbRedMnemonic

Note, this is a hack you should only consider if you can't get the
Locale handling to work.

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top