Combo-box key value pair in JavaFX 2

前端 未结 3 1426
梦谈多话
梦谈多话 2020-11-30 06:13

I am just starting to learn JavaFX 2.
Now I am trying to build a sample application. Then I got stuck in combobox.
I did not find any reference to key value pair for

3条回答
  •  佛祖请我去吃肉
    2020-11-30 06:38

    I know that this question is old, but because I just spent hours in pointless digging on this issue it's a kind of mandatory for me to share the results. It seems that the ComboBox with overriden toString() method resolves the strings back to objects just right even if there are string duplicates in the list. The resolution must be index based and toString() is used only for presentation.

提交回复
热议问题