Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.combobox
Class MapComboBoxModel<K,V>

    java.lang.Object
      javax.swing.AbstractListModel
          org.jdesktop.swingx.combobox.ListComboBoxModel<K>
              org.jdesktop.swingx.combobox.MapComboBoxModel<K,V>

Type Parameters:
  `K` - the type of keys maintained by the map backing this model
  `V` - the type of mapped values

All Implemented Interfaces:
  java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener, javax.swing.ComboBoxModel, javax.swing.ListModel

    public class MapComboBoxModel<K,V>

extends ListComboBoxModel<K>

A `ComboBoxModel` for `Map`s. The model will always present a `Map` consistently, once it is instantiated. However, unless the `Map` is ordered, as a `java.util.TreeMap` is, the model is not guaranteed to present the maps in a consistent order between instantiations.

Author:
  jm158417, Karl George Schaefer
See Also:
  Serialized Form

Field Summary
`protected java.util.Map<K,V>` | `map_data` The map backing this model.

Fields inherited from class org.jdesktop.swingx.combobox.ListComboBoxModel
`data, selected, UPDATE`

Fields inherited from class javax.swing.AbstractListModel
`listenerList`

Constructor Summary
`MapComboBoxModel()` Creates an empty model.
`MapComboBoxModel(java.util.Map<K,V> map)` Creates a model backed by the specified map.

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent evt)`
`int` | `getSize()`
`V` | `getValue(int selectedItem)` Selects an item from the model and returns that map value.
`V` | `getValue(java.lang.Object selectedItem)` Selects an item from the model and returns that map value.

Methods inherited from class org.jdesktop.swingx.combobox.ListComboBoxModel
`getElementAt, getSelectedItem, setSelectedItem`

Methods inherited from class javax.swing.AbstractListModel
`addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.swing.ListModel
`addListDataListener, removeListDataListener`

Field Detail

### map_data

    protected java.util.Map<K,V> map_data

  The map backing this model.

Constructor Detail

### MapComboBoxModel

    public MapComboBoxModel()

  Creates an empty model.

### MapComboBoxModel

    public MapComboBoxModel(java.util.Map<K,V> map)

  Creates a model backed by the specified map.

  Parameters:
    `map` - the map backing this model

Method Detail

### getSize

    public int getSize()

  Specified by:
    `getSize` in interface `javax.swing.ListModel`
  Overrides:
    `getSize` in class `ListComboBoxModel<K>`

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent evt)

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`
  Overrides:
    `actionPerformed` in class `ListComboBoxModel<K>`

### getValue

    public V getValue(java.lang.Object selectedItem)

  Selects an item from the model and returns that map value.

  Parameters:
    `selectedItem` - the item to select
  Returns:
    the value for the selected item

### getValue

    public V getValue(int selectedItem)

  Selects an item from the model and returns that map value.

  Parameters:
    `selectedItem` - selects the item at the specified index in this model
  Returns:
    the value for the item at the selected index

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.