Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用 Netbeans Builder 设计了一个 JTable并创建了 5 列,第 5 列是Boolean所以我想知道当用户选择时如何突出显示整行。
JTable
Boolean
有关根据行中的值为整行着色的简单方法,请参阅表格行渲染。
现在的问题是,当您单击复选框时,只有单元格会自动重新绘制,因此您还需要添加 a TableModelListener,这样您就可以在复选框的状态更改时在表格行上TableModel调用 a 。repaint()
TableModelListener
TableModel
repaint()