assign keys for combo box in java

后端 未结 3 1549
星月不相逢
星月不相逢 2021-01-26 10:27

I want to add a JComboBox in Swing that is simple but I want to assign the values for each items in combo. I have the following code

    JComboBox         


        
3条回答
  •  清酒与你
    2021-01-26 10:45

    you can create your own Model and add it to the combo box instead of adding Strings directly.

    check Java ComboBoxModel.

    you can find more info in this thread

提交回复
热议问题