示例#1
0
 private void addPainter(myjava.gui.syntax.Painter painter) {
   EntryListPanel newPanel = new EntryListPanel(painter);
   listPanelSet.add(newPanel);
   centerPanel.add(newPanel, painter.getName());
   painterComboBox.removeItemListener(painterChangeListener);
   painterComboBox.removeAllItems();
   for (EntryListPanel p : listPanelSet) {
     painterComboBox.addItem(p.getPainter());
   }
   removedPainters.remove(painter);
   painterComboBox.addItemListener(painterChangeListener);
 }
 private void applySelectedValue(JComboBox comboBox, Object value) {
   comboBox.removeItemListener(this);
   ValueLabelItem currentItem;
   for (int i = 0; i < comboBox.getItemCount(); i++) {
     currentItem = (ValueLabelItem) comboBox.getItemAt(i);
     if (currentItem.getValue().equals(value)) {
       comboBox.setSelectedIndex(i);
       break;
     }
   }
   comboBox.addItemListener(this);
 }