Assuming you know how to encode a dialog using JComboBox, follow these steps to load Enum values ββinto a combo box:
enum ItemType {First, Second, Third}; JComboBox myEnumCombo = new JComboBox(); myEnumCombo.setModel(new DefaultComboBoxModel(ItemType.values());
Then, to get the value as enum, you could do
(ItemType)myEnumCombo.getSelectedItem();
There is no need to assign identifiers for enumerations unless your application logic needs to have a meaningful identifier. Enum itself already has a unique identification system.
ring bearer
source share