Results 1 to 11 of 11
- 01-12-2010, 10:26 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
File chooser internationalization problem
Hello All!
I'm trying to have Armenian texts on Swing components.
Only DialogTitleText is working. And if I'm trying to internationalize other Swing components: buttons and so on, the only problem with JFrame title is.Java Code:Locale hay = new Locale("hy", "HY"); Locale.setDefault(hay); UIManager.put("FileChooser.openDialogTitleText", "Բացել"); UIManager.put("FileChooser.saveDialogTitleText", "Պահել"); UIManager.put("FileChooser.lookInLabelText", "Փնտրել"); UIManager.put("FileChooser.saveInLabelText", "Պահել"); UIManager.put("FileChooser.upFolderToolTipText", "Մի Մակարդակ Վերև"); UIManager.put("FileChooser.homeFolderToolTipText", "Աշխատաէկրան"); UIManager.put("FileChooser.newFolderToolTipText", "Ստեղծել Նոր Պանակ"); UIManager.put("FileChooser.listViewButtonToolTipText", "Ցուցակ"); UIManager.put("FileChooser.detailsViewButtonToolTipText", "Մանրամասներ"); UIManager.put("FileChooser.fileNameHeaderText", "Անուն"); UIManager.put("FileChooser.fileSizeHeaderText", "Ծավալ"); UIManager.put("FileChooser.fileTypeHeaderText", "Տեսակ"); UIManager.put("FileChooser.fileDateHeaderText", "Փոփոխման Ամսաթիվ"); UIManager.put("FileChooser.fileAttrHeaderText", "Հատկանիշներ"); UIManager.put("FileChooser.fileNameLabelText", "Նշոցի Անուն"); UIManager.put("FileChooser.filesOfTypeLabelText", "Նշոցների Տեսակներ"); UIManager.put("FileChooser.openButtonText", "Բացել"); UIManager.put("FileChooser.openButtonToolTipText", "Բացել Ընտրված Նշոցը"); UIManager.put("FileChooser.saveButtonText", "Պահել"); UIManager.put("FileChooser.saveButtonToolTipText", "Պահել Ընտրված Նշոցը"); UIManager.put("FileChooser.directoryOpenButtonText", "Պահել"); UIManager.put("FileChooser.directoryOpenButtonToolTipText", "Պահել Ընտրված Նշոցը"); UIManager.put("FileChooser.cancelButtonText", "Դադարեցնել"); UIManager.put("FileChooser.cancelButtonToolTipText", "Դադարեցնել Նշոց Ընտրման Երկխոսության Պատուհանը"); UIManager.put("FileChooser.newFolderErrorText", "Նոր Պահոցի Ստեղծման Սխալ"); UIManager.put("FileChooser.acceptAllFileFilterText", "Բոլոր Նշոցներ");
I'm working on WindowsXP, and java version is 1.6.0_17.
Thanks in advance!
Astghik
- 01-12-2010, 05:31 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,391
- Blog Entries
- 7
- Rep Power
- 17
Did you do an updateUI() on your fileChooser? i.e.
kind regards,Java Code:chooser.updateUI();
Jos
- 01-13-2010, 12:15 AM #3
What does the FileChooser look like with just the locale set to hy/HY when you start the JVM?
- 01-13-2010, 08:16 AM #4
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
- 01-13-2010, 08:25 AM #5
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
- 01-13-2010, 11:08 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,391
- Blog Entries
- 7
- Rep Power
- 17
- 01-13-2010, 12:58 PM #7
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 282
- Rep Power
- 4
Latest news: I have seen Armenian in Java!
It exists in two fonts on my Windows installation:
- Sylfaen
- Arial Unicode MS
I found these by checking all fonts with FontSelector.java,
where I changed the sample string to include Armenian character in unicode escapes: \u0532\u0561\u0581
The fonts themselves are in C:\Windows\Fonts, which is where I found the file name, ARIALUNI.TTF
I changed the program code only to add: chooser.updateUI()
(I also had to change the question marks from cut/paste into proper unicode escapes.)
Finally I created the file .../jre/lib/fontconfig.properties
and disabled the other fontconfig files by changing their names.
I began by copying fontconfig.properties.src in the same directory.
(It is attached, but the ".txt" in its name must be deleted.)
To the file I added the following lines:
- after each group of lines beginning dialogxxx.yyy I added a line: dialogxxx.yyy.unicode=Arial Unicode MS
- to the end of the line beginning "sequence.fallback=" I added ",unicode
- at the end of the file I added a line: "filename.Arial_Unicode_MS=ARIALUNI.TTF"
--- older notes
Armenian is not among the supported locales listed in Java SE Supported Locales.
Could be a problem.
But the code is using unicode escapes.
And I get the same result whether or not I set the locale.
chooser.updateUI() is essential.
In Firefox I do see Aremenian characters. Attached.
When I copy/paste into MSWord, I see the same.
- 01-13-2010, 02:12 PM #8
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
I have sold in the following way!
Java Code:public void setFileChooserFont(Component[] comp) { Font font = new Font("Sylfaen", Font.BOLD, 14); for (int x = 0; x < comp.length; x++) { if (comp[x] instanceof Container) { setFileChooserFont(((Container) comp[x]).getComponents()); } comp[x].setFont(font); } }I appreciate your help very much!!Java Code:JFileChooser fc = new JFileChooser(); setFileChooserFont(fc.getComponents());
Thank you!!
Astghik
- 01-14-2010, 01:42 AM #9
So it was a font issue? Looking at the screen shot, it appeared that the character set had changed but the font didn't support it. My question is, did changing the locale cause the text to change to hy?
- 01-14-2010, 06:48 AM #10
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
- 01-14-2010, 06:44 PM #11
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 282
- Rep Power
- 4
This cannot work; JFileChooser does not look for a FileChooser.font property.UIManager.put("FileChooser.font", font);
JFileChooser--and all other widgets--use the standard logical font called "Dialog".
And the physical font usually assigned to the Dialog font does not have glyphs for the Armenian characters.
The changes that I gave for the fontconfig.properties file will fix ALL widgets so they will display Armenian.
It will fix other characters in many languages that are in the Arial Unicode font.
And without affecting existing applications.
I continue to use the revised fontconfig.properties file on my home system
because it will let me see more characters correctly.
{The setFileChooserFont() kludge that "sold" [solved] the problem above
will change the fonts only for that one instance of JFileChooser.
And it gets it wrong by changing some bold fonts to plain.
Why is it that some programmers will reject a 100% solution with no programming
in favor of a 7% solution that is done with coding but leaves the underlying problem festering?}
Similar Threads
-
Color Chooser Demo
By Java Tip in forum javax.swingReplies: 0Last Post: 06-27-2008, 07:48 PM -
[SOLVED] File chooser selecting file from directory...?
By prabhurangan in forum AWT / SwingReplies: 12Last Post: 06-18-2008, 04:08 AM -
Using File Chooser
By shaungoater in forum New To JavaReplies: 0Last Post: 03-20-2008, 12:30 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks