Skip to main content

About JXLoginPanel

5 replies [Last post]
qiyadeng
Offline
Joined: 2005-10-23

I used JXLoginPanel for login.
There is "Name","password","login","cancel" on the label or button.
I'm not in english contry,I want to change it to my own description.
How to do it?Thanks...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rah003
Offline
Joined: 2004-05-26

Depends on what language are you interested in. There are currently English, French, Spanish and Portugese locales available with JXLoginPanel. If you want different language you would have to translate those labels yourself ... if you do so we would be definitively interested in getting more locales in.
Now once you have translation of all terms ready to get it working in your code this is what you would do normally.
a) Your system setting points to correct locales and it will be picked up automatically
b) You change default locales programatically by setting default locale in application context. For example to get locales to switch to french you would call:[code]
sun.awt.AppContext.getAppContext().put("JComponent.defaultLocale", Locale.FRENCH);
[/code]
c) You want to change locales only for one component and so you call [code]
myLoginPanel.setLocale(Locale.FRENCH);
[/code]

Unfortunately non of those options (except maybe first one) seems to work properly due to various issues.

kschaefe
Offline
Joined: 2006-06-08

I believe this [url=https://swingx.dev.java.net/issues/show_bug.cgi?id=447]bug[/url] touches on why 2 and 3 fail. The resources are loaded and set during static initialization.

Karl

rah003
Offline
Joined: 2004-05-26

True, tho I think current implementation would not work properly with setLocale() even if that static code was moved to the addon ... but maybe I'm wrong. I'll give it try to see how it behaves.

rah003
Offline
Joined: 2004-05-26

Yeah, it was definitively bit more then what was suggested in #447 but it should work properly now (build #284). All above mentioned cases should work on jdk1.6, first and last will work also on 1.5.

kschaefe
Offline
Joined: 2006-06-08

Well, I believe that JComponent.setDefaultLocale defers to b on 1.6, but it has been there since 1.4 so if that works for 1.5 then it's completely solved.

Karl