javaswingnetbeansjcomboboxmatisse

Netbeans Swing Matisse JCombobox Key-Value Pair


is there a way to set Key-Value String Map/Pair in JCombobox Netbeans Swing Matisse using GUI only ? Below screenshot allow to insert single list JComboBox List Data

but is there a way to insert Map/Key-Value String Pair using Matisse GUI instead of code like

Value - Display
_____   _____
ITEM1 - Item 1
ITEM2 - Item 2
ITEM3 - Item 3
ITEM4 - Item 4

as in HTML select option tag stored value and display value.


Solution

  • So that why i am asking about using GUI not Code

    Don't depend on an IDE to write/generate your code for you. The code will never be portable.

    Maybe you can create a text file of all you key/value pairs. Then you create a simple routine that reads each file parses the data and adds a custom object to the ComboBoxModel.

    For an example of such a custom object check out Combo Box With Hidden Data. It is a simple object that overrides the toString() method to display the value in the combo box.

    And for those that suggest you should be using a custom Renderer, well they are only half right. Check out Combo Box With Custom Renderer which allows you to use a custom renderer without breaking the default functionality of the combo box.