예제 #1
0
 @Override
 public void clear() {
   UISingleton.runInSwing(
       new Runnable() {
         @Override
         public void run() {
           try {
             selecting = true;
             b.removeAllItems();
           } finally {
             selecting = false;
           }
         }
       });
 }
예제 #2
0
 @Override
 public void addValue(Object key, String value) {
   final KeyWrapper wrapper = new KeyWrapper(key, value);
   UISingleton.runInSwing(
       new Runnable() {
         @Override
         public void run() {
           try {
             selecting = true;
             b.addItem(wrapper);
           } finally {
             selecting = false;
           }
         }
       });
 }
예제 #3
0
 @Override
 public void setSelected(final Object key) {
   UISingleton.runInSwing(
       new Runnable() {
         @Override
         public void run() {
           try {
             selecting = true;
             for (int i = 0; i < b.getItemCount(); i++) {
               KeyWrapper kw = (KeyWrapper) b.getItemAt(i);
               if (kw.key == null) {
                 if (key == null) b.setSelectedIndex(i);
               } else if (kw.key.equals(key)) {
                 b.setSelectedIndex(i);
               }
             }
           } finally {
             selecting = false;
           }
         }
       });
 }