I've created MyFileChooser that extends JFileChooser. So I want to localize its UI. This code doesn't work - all labels are still in english.
I tried to do it in this way:
UIManager.put("MyFileChooser.lookInLabelText", rb.getString("lookInLabelText"));
but it didn't help.
Asked
Active
Viewed 179 times
1

Andrew Thompson
- 168,117
- 40
- 217
- 433

Zharro
- 819
- 1
- 11
- 23
-
why have you extended the chooser? Is the normal (that is not extended) chooser localized correctly? What exactly did you do? – kleopatra Nov 20 '12 at 11:07
-
@kleopatra there are difference between full localized OS and accesible Locale, a few times asked similair question by OPS came from south part Europe (???) – mKorbel Nov 20 '12 at 11:37
1 Answers
2
You need to set those properties before you create the JFileChooser (for example, doing it in the MyFileChooser constructor is too late, because the super contructor is already called at that point).
You might work around (haven't tested) by calling updateUI() on the file chooser after setting the properties.

Walter Laan
- 2,956
- 17
- 15
-
or by using [SwingUtils](http://stackoverflow.com/questions/12519951/location-of-string-keys-in-lf/12520992#12520992) by [@Darryl](http://tips4java.wordpress.com/2008/11/13/swing-utils/) – mKorbel Nov 20 '12 at 11:45