Last active
June 4, 2017 15:45
-
-
Save mansour-gabteni/02c2feda4cca2810043de92eadb6bdcc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ComboItem | |
| { | |
| private String key; | |
| private String value; | |
| public ComboItem(String key, String value) | |
| { | |
| this.key = key; | |
| this.value = value; | |
| } | |
| @Override | |
| public String toString() | |
| { | |
| return key; | |
| } | |
| public String getKey() | |
| { | |
| return key; | |
| } | |
| public String getValue() | |
| { | |
| return value; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| comboBox.addItem(new ComboItem("Visible String 1", "Value 1")); | |
| comboBox.addItem(new ComboItem("Visible String 2", "Value 2")); | |
| comboBox.addItem(new ComboItem("Visible String 3", "Value 3")); | |
| Object item = comboBox.getSelectedItem(); | |
| String value = ((ComboItem)item).getKey(); | |
| String value = ((ComboItem)item).getValue(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment