1

one question with the java jTable class. Actually I am not a Java programmer and just now using Java to design a GUI in Matlab. What I've done is:

  • A jTable is built into a Matlab GUI.
  • I used/called a RowFilter in jTable, which can make the jTable to show the filtering results.
  • Then from the results in this filtered view I used the removeRow method from table model to remove one or several selected rows.

The problem is that everytime if I remove a row, the table content refreshs itself as wanted, but the scroll bar jumps back to the beginning.

Does anyone know how to inhibit this jumping and keep the original view of jTable? Because this helps me not to have to scroll back to find the original position where I started the deleting.

Thank u for ur advice and help.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
OISS
  • 97
  • 10

1 Answers1

1

Invoke the table's scrollRectToVisible() method; pass it the Rectangle returned by getCellRect() for the desired row.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045