Java – localize Jfilechooser “all files” string
•
Java
I'm using Jfilechooser to develop a Java application where users can switch languages
Locale.setDefault( Locale.ENGLISH ); JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog( null ); Locale.setDefault( Locale.CHINA ); JFileChooser.setDefaultLocale( Locale.CHINA ); JFileChooser chinese_chooser = new JFileChooser(); chinese_chooser.showOpenDialog( null );
In addition to the "all files" string in the drop-down box, the second file selector to display is Chinese If I comment out the first part of the code, the file selector will display all translated strings correctly
Is this an error in Java or do I need to set the locale elsewhere?
How can I make the translation file selector display correctly?
Solution
I found something that might help you here. Here is how to change the all files string:
UIManager.put("FileChooser.acceptAllFileFilterText","abc4");
Set the default locale to locale Before China, please put it in the correct position The bad thing is that it hasn't changed locally, but maybe it will provide you with the job you need
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码