Java - Check Boxes in a JComboBox

后端 未结 4 1417
-上瘾入骨i
-上瘾入骨i 2020-12-04 03:00

I would like to make a JComboBox that has check boxes for items instead of text. In addition, it should be possible to check multiple items and retrieve the selected items f

4条回答
  •  眼角桃花
    2020-12-04 03:27

    We were once given this same inane requirement as well. We complied with a brand new component. It was essentially a JPanel which had a text field and a down arrow button. It contained a JList which used a JCheckbox-derrived ListCellRenderer. The JList was packaged in a JPopupMenu which was displayed on mouse clicks.

提交回复
热议问题