Calculate running total in JTable

前端 未结 3 1195
日久生厌
日久生厌 2020-12-11 12:22

I need to populate a column in my JTable that computes a running total as is shown below.

ID   Name   Position   Salary    Total
===  ====== ========== ====         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 12:40

    Each call to getValueAt must produce the value for the requested cell without relying on the result of any previous call to getValueAt, because you have no control over when and how often getValueAt will be called.

    Recompute the correct total each time it is requested as in @trashgod's example.

提交回复
热议问题