且构网

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

访问JTable单元格组件

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

大概是,渲染器和编辑器从TableModel获取现有的选择状态,也许更新了ListSelectionModel的实例,该实例用作准备使用的组件.您可以在实现stopCellEditing()的过程中更新 other 模型值.您的TableModel必须为其他单元触发一个合适的TableModelEvent;对于正在编辑的值,请这样做.可以在此处看到一个相关示例.

Presumably, your renderer and editor obtain the existing selection state from your TableModel, perhaps updating an instance of ListSelectionModel that is used as part of preparing the component for use. You can update the other model value(s) in your implementation of stopCellEditing(). Your TableModel will have to fire a suitable TableModelEvent for the other cells; do not do so for the value being edited. A related example is seen here.