How to edit a JList item text by double clicking on it?

我只是一个虾纸丫 提交于 2019-12-11 00:01:03

问题


I have a JList populated with Strings. I want to be able to edit an item by double clicking on it and then edit its text in the JList itself. So if I click an item, then it's highlighted and I see the cursor, then for example I delete the text and write something else. Then I click enter and the text is edited successfully. Is that possible & how can I do this please? I really need this.


回答1:


See List Editor for a couple of solutions, one is to just use a JTable, the other is to create a custom edit Action for the JList.



来源:https://stackoverflow.com/questions/19212232/how-to-edit-a-jlist-item-text-by-double-clicking-on-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!