How to use Map element as text of a JComboBox

前端 未结 3 1815
别跟我提以往
别跟我提以往 2020-12-03 15:20

I am populating a JComboBox (using addItem()) with all the elements of a collection. Each element in the collection is a HashMap (so its a ComboBo

3条回答
  •  無奈伤痛
    2020-12-03 16:16

    If you want to override the toString() method you could just create a decorator class that implements Map and uses a HashMap to implemented the needed methods and give your own implementation of toString().

提交回复
热议问题