如何通过双击编辑JList项目文本? [英] How to edit a JList item text by double clicking on it?

查看:49
本文介绍了如何通过双击编辑JList项目文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用字符串填充的JList.我希望能够通过双击项目来进行编辑,然后在JList本身中编辑其文本.因此,如果我单击一个项目,然后将其突出显示,然后看到光标,那么例如,我删除了文本并写了其他东西.然后,单击Enter,文本已成功编辑.那有可能吗?请问我该怎么做?我真的需要这个.

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.

推荐答案

请参见列表编辑器提供了两种解决方案,一种是仅使用JTable,另一种是为JList创建自定义编辑动作.

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.

这篇关于如何通过双击编辑JList项目文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆