Swing/Locale のバックアップの現在との差分(No.11)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/Locale へ行く。
- 1 (2008-01-07 (月) 12:38:12)
- 2 (2008-01-07 (月) 14:51:16)
- 3 (2011-01-18 (火) 02:29:14)
- 4 (2011-01-19 (水) 00:35:22)
- 5 (2014-11-01 (土) 00:46:09)
- 6 (2015-12-01 (火) 15:06:02)
- 7 (2016-05-26 (木) 15:13:34)
- 8 (2017-03-31 (金) 16:13:35)
- 9 (2017-06-05 (月) 20:44:55)
- 10 (2017-11-02 (木) 15:34:40)
- 11 (2018-05-25 (金) 18:42:39)
- 12 (2019-11-15 (金) 18:40:06)
- 13 (2021-06-02 (水) 12:17:58)
- 14 (2022-08-20 (土) 22:15:25)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: Locale title: JFileChooserにLocaleを設定する tags: [JFileChooser, Locale] author: aterai pubdate: 2008-01-07T12:38:12+09:00 description: JFileChooserにLocaleを設定して、タイトルやボタンの文字列を変更します。 image: https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTPdRLH4_I/AAAAAAAAAeA/tZciS7a5CCc/s800/Locale.png --- * 概要 [#summary] `JFileChooser`に`Locale`を設定して、タイトルやボタンの文字列を変更します。 #download(https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTPdRLH4_I/AAAAAAAAAeA/tZciS7a5CCc/s800/Locale.png) * サンプルコード [#sourcecode] #code(link){{ //JFileChooser.setDefaultLocale(Locale.ENGLISH); // JFileChooser.setDefaultLocale(Locale.ENGLISH); fileChooser.setLocale((Locale) combo.getSelectedItem()); fileChooser.updateUI(); SwingUtilities.updateComponentTreeUI(fileChooser); }} * 解説 [#explanation] 上記のサンプルでは、コンボボックスで指定したロケールを`JFileChooser`に設定してから開くようになっています。 タイトル、ボタンのラベルなどが、指定したロケールに変更されます。 上記のサンプルでは、`JFileChooser`のタイトル、ボタンのラベルなどを指定した`Locale`に対応した文字列に変更するテストができます。 - `ファイルのタイプ(T): JComboBox`の「すべてのファイル」などは更新されない -- `java -Duser.language=fr -jar example.jar`で起動すると`Locale`を変更しても`Tous les fichiers`から変化しない - 詳細表示`JTable`のヘッダは更新されない -- `JDK 8`では`java -Duser.language=fr -jar example.jar`で起動しても「名前、サイズ、項目の種類、更新日時」など`OS`が使用しているロケール?から文字列が取得される? -- `JDK 13`では`java -Duser.language=fr -jar example.jar`で起動すると`Locale`を変更しても「`Nom, Taille, ...`」から変化しない * 参考リンク [#reference] - [https://bugs.openjdk.java.net/browse/JDK-6606475 Bug ID: 6606475 JComponent.setDefaultLocale(Locale.ENGLISH) useless if def locale is non-english] - [https://bugs.openjdk.org/browse/JDK-6606475 Bug ID: 6606475 JComponent.setDefaultLocale(Locale.ENGLISH) useless if def locale is non-english] -- `JDK 1.5.0_13`では、`JVM`のデフォルトが`English`以外の場合、`Component#setLocale(Locale.ENGLISH)`や、`JComponent.setDefaultLocale(Locale.ENGLISH)`としても反映されない -- `JDK 1.6.0`で修正済み -- `JDK 1.8.0`では再発している? * コメント [#comment] #comment - メモ: [https://bugs.openjdk.java.net/browse/JDK-6342301 Bug ID: 6342301 Bad interaction between setting the ui and file filters in JFileChooser] -- &user(aterai); &new{2011-01-18 (火) 02:29:14}; - メモ: [https://bugs.openjdk.org/browse/JDK-6342301 Bug ID: 6342301 Bad interaction between setting the ui and file filters in JFileChooser] -- &user(aterai); &new{2011-01-18 (火) 02:29:14}; #comment