Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
を使用jComboBoxしてリフレッシュしたいと考えています。ただし、デフォルト値を含む、利用可能なすべてのアイテムが削除されます。jComboBoxで常に値を保持したい。jComboBoxjComboBox.removeAllItems()jComboBoxSelectSelect
jComboBox
jComboBox.removeAllItems()
Select
注:インターネットで検索しましたが、求めていた正確な解決策が見つかりません。
ありがとう。
JComboBox<String> cb = new JComboBox<String>(); String tmp = cb.getItemAt(0); cb.removeAll(); cb.addItem(tmp);
0 は、保存するインデックスです。