java - Updating JTable row dynamically after the deletion successive rows -


I have a JTable and I'm putting that JTable dynamically in lines. After some user intervention, a The new line will be inserted. Then I will call a function as the selected row number with the parameter and within that function, I will have some code that will update the same line accordingly. Each line entry and line value will run the update code in a separate thread.

  Public Zero updateRow (int row, JTable myTable) {string text = ""; // After several processing, set the table cell value on the 'row' on the 4 column myTable.setValueAt (text, line, 4); }   

The problem I am facing is as follows,

If the user is removing any row, the status of the row will change and that Time function UpdateRow () is trying to update some other line, then it will fail due to change in line number.

Indicates that I have 3 lines at one time and updates on each line are turned on. line for first line update (1, usertable); // Row (2, UsTable) for second line updates; // third row for

and the second row's updateRow () has been completed, due to the 3rd row line of the updateRow () function will cause the problem because, the row value in it '2 'Since the third row has been removed, there is no third row and in turn the reason for the failure of the following code is

  myTable.setValueAt (text, row, 4); // At present, the value in the line can be as '2', Can someone suggest me how to keep track of line updates according to line, even if line status has changed dynamically ?  

Thanks in advance.

Instead of relying on this view line number, work directly on the model, as suggested. In a comment by @Mackabel; If you change the model, then the view must be followed as discussed, " JTable provides the methods to convert the model to coordinates. The model changes the coordinates, which are "contracted up"

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -