且构网

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

JTable中的JSlider

更新时间:2023-12-04 12:57:28

我在推测您的 sscce .但我可以建议您认真审查两件事:

Absent your sscce, I'm speculating; but I can suggest two things to examine critically:

  1. getTableCellEditorComponent()中,实际参数value来自表模型.您的setValue()调用会将value转发到滑块的范围模型.超出范围的value固定到极端.

  1. In getTableCellEditorComponent(), the actual parameter value comes from your table model. Your setValue() invocation forwards the value to the slider's range model. An out-of-range value is pinned to the extreme.

您的ChangeListener需要fireEditingStopped(),如此相关 查看全文