/** * Selects an item from the model and returns that map value. * * @param selectedItem * selects the item at the specified index in this model * @return the value for the item at the selected index */ public V getValue(int selectedItem) { return getValue(getElementAt(selectedItem)); } }
/** * Creates a model backed by the specified map. * * @param map * the map backing this model */ public MapComboBoxModel(Map<K, V> map) { super(buildIndex(map)); this.map_data = map; }
if (myComponent instanceof JComboBox) { JComboBox jComboBox = (JComboBox) myComponent; MapComboBoxModel model = (MapComboBoxModel) jComboBox.getModel(); values+=""+model.getValue(model.getSelectedItem())+","; }
/** * {@inheritDoc} */ public void actionPerformed(ActionEvent evt) { //kgs - this code might not be performant with large maps if(evt.getActionCommand().equals(UPDATE)) { //add new keys Set<K> keys = map_data.keySet(); keys.removeAll(data); data.addAll(keys); //remove dead keys List<K> copy = new ArrayList<K>(data); keys = map_data.keySet(); copy.removeAll(keys); data.removeAll(copy); fireContentsChanged(this, 0, getSize()); } }
panel.add(scriptCharset); myStartMode = new ComboBox(new MapComboBoxModel<>(PerlDebugOptionsSets.STARTUP_OPTIONS)) { @Override public void setRenderer(ListCellRenderer renderer) {
/** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent evt) { //kgs - this code might not be performant with large maps if(evt.getActionCommand().equals(UPDATE)) { //add new keys Set<K> keys = map_data.keySet(); keys.removeAll(data); data.addAll(keys); //remove dead keys List<K> copy = new ArrayList<K>(data); keys = map_data.keySet(); copy.removeAll(keys); data.removeAll(copy); fireContentsChanged(this, 0, getSize() - 1); } }
myPerlRole = new ComboBox(new MapComboBoxModel<>(PerlDebugOptionsSets.ROLE_OPTIONS)) { @Override public void setRenderer(ListCellRenderer renderer) {
/** * Selects an item from the model and returns that map value. * * @param selectedItem * selects the item at the specified index in this model * @return the value for the item at the selected index */ public V getValue(int selectedItem) { return getValue(getElementAt(selectedItem)); } }
/** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent evt) { //kgs - this code might not be performant with large maps if(evt.getActionCommand().equals(UPDATE)) { //add new keys Set<K> keys = map_data.keySet(); keys.removeAll(data); data.addAll(keys); //remove dead keys List<K> copy = new ArrayList<K>(data); keys = map_data.keySet(); copy.removeAll(keys); data.removeAll(copy); fireContentsChanged(this, 0, getSize() - 1); } }
/** * Creates a model backed by the specified map. * * @param map * the map backing this model */ public MapComboBoxModel(Map<K, V> map) { super(buildIndex(map)); this.map_data = map; }
/** * Selects an item from the model and returns that map value. * * @param selectedItem * selects the item at the specified index in this model * @return the value for the item at the selected index */ public V getValue(int selectedItem) { return getValue(getElementAt(selectedItem)); } }
/** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent evt) { //kgs - this code might not be performant with large maps if(evt.getActionCommand().equals(UPDATE)) { //add new keys Set<K> keys = map_data.keySet(); keys.removeAll(data); data.addAll(keys); //remove dead keys List<K> copy = new ArrayList<K>(data); keys = map_data.keySet(); copy.removeAll(keys); data.removeAll(copy); fireContentsChanged(this, 0, getSize() - 1); } }
/** * Creates a model backed by the specified map. * * @param map * the map backing this model */ public MapComboBoxModel(Map<K, V> map) { super(buildIndex(map)); this.map_data = map; }
/** * Selects an item from the model and returns that map value. * * @param selectedItem * selects the item at the specified index in this model * @return the value for the item at the selected index */ public V getValue(int selectedItem) { return getValue(getElementAt(selectedItem)); } }
/** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent evt) { //kgs - this code might not be performant with large maps if(evt.getActionCommand().equals(UPDATE)) { //add new keys Set<K> keys = map_data.keySet(); keys.removeAll(data); data.addAll(keys); //remove dead keys List<K> copy = new ArrayList<K>(data); keys = map_data.keySet(); copy.removeAll(keys); data.removeAll(copy); fireContentsChanged(this, 0, getSize() - 1); } }
/** * Creates a model backed by the specified map. * * @param map * the map backing this model */ public MapComboBoxModel(Map<K, V> map) { super(buildIndex(map)); this.map_data = map; }
/** * Selects an item from the model and returns that map value. * * @param selectedItem * selects the item at the specified index in this model * @return the value for the item at the selected index */ public V getValue(int selectedItem) { return getValue(getElementAt(selectedItem)); } }
/** * Creates a model backed by the specified map. * * @param map * the map backing this model */ public MapComboBoxModel(Map<K, V> map) { super(buildIndex(map)); this.map_data = map; }