このJavaSwingJComboBoxは、システム構成の変更に基づいて変更されます。例の画像では、「Press to Select」は何も選択されておらず、構成に「Test Unit」が1つある場合ですが、「PresstoSelect」がドロップダウンに2回表示されます。追加の「PresstoSelect」アイテムはアイテム0のように動作するため機能的ですが、このように見た目はお粗末です。何か案は?
public class Controller extends javax.swing.JFrame implements Observer {
...
public void update(Observable o, Object arg) {
jComboBox.removeAllItems();
jComboBox.addItem("Press to Select");
String[] names = Configuration.getNames();
for (String n : names) {
jComboBox.addItem(n);
}
...