How to create a drop-down list in java swing with multiple item selection?

前端 未结 4 405
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 17:00

I\'m aware of JList and JComboBox. I need the combo box drop down functionality with multiple selection functionality that JList provi

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 17:43

    When using multi-select, it's better to use a list than a combo box. As GUI metaphors go, people expect a combo box to be single select, whereas lists can be either.

    the contents of the list are too huge to be displayed using a simple list

    Place the JList in a JScrollPane. You can call setVisibleRowCount(int) on the JList to specify how many rows at a time should be shown.

提交回复
热议问题