且构网

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

如何添加的JTable中单元格内的按钮,并给它的行动

更新时间:2023-12-03 14:15:58

您需要的两个的渲染器的的和编辑,如本的例如的。见的如何使用表:编辑器和渲染器的对的详细信息。四角切圆,你应该覆盖的方法的isCellEditable()的TableModel 而不是扩展的JTable

You need both a renderer and and editor, as shown in this example. See How to Use Tables: Editors and Renderers for details. Tangentially, you should override the method isCellEditable() in your TableModel rather than extending JTable.