且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JButton不响应单击事件

更新时间:2023-12-02 11:40:04

您也应该创建一个自定义列表单元格编辑器,它会重用ListCellRenderer中的代码进行外观,但在按钮上实现动作侦听器. 单元格渲染器仅用于在列表中标记图形图像.要在JList中使用控件,应使用单元格编辑器.

You should create a custom List Cell Editor too, wich reuses code from ListCellRenderer for looks, but implements action listener on button. The cell renderers are used just to stamp graphic images in list. For using controls in JList you should use cell editors.