私のアプリは複数の言語を持つ必要があります。英語はデフォルトです。問題は、ユーザーが異なる言語に切り替えると、ComboBox
選択値を除いてすべてが翻訳されることです。これは、それがどのように見えるかです:ComboBox
背後ComboBox選択された値が翻訳されない
コードされています
私が選択した値がリフレッシュ取得できますかObservableList<Currency> currencyItem= CurrencyDA.getCurrencies();
currenciesComboBox.setItems(currencyItem);
Callback<ListView<Currency>, ListCell<Currency>> currencyFactory = lv -> new ListCell<Currency>(){
@Override
protected void updateItem(Currency currency, boolean empty){
super.updateItem(currency, empty);
setText(empty ? "" : interfaceBundle.getString("currency_"+currency.getName()));
}
};
currenciesComboBox.setCellFactory(currencyFactory);
currenciesComboBox.setButtonCell(currencyFactory.call(null));
currenciesComboBox.getSelectionModel().selectFirst();
?
あなたのアップデート項目の方法があることにも注意してくださいこれを行う1つの方法は、次のコードであります違う。 itemが!= nullであるかどうかをテストし、setTextより前に空でない場合はセルに、そうでなければnullに設定する必要があります。 Plsは、ドキュメント – user43968