Select Multiple Items In JList Without Using The Ctrl/Command Key

前端 未结 4 1366
温柔的废话
温柔的废话 2021-02-08 10:01

I am looking for a way to select multiple items within a JList by just clicking each item.

The normal way to do this is to hold the command/ctrl key and then click.

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-08 10:33

    I think you can easily accomplish this by attaching a mouse listener on your JList and selecting programatically the item in the listener code. Of course you will probably need some code to determine which item was pressed basing on some coordinates.

提交回复
热议问题