[java]swing scroll refresh - rafraichissement quand bcp de lignes

Bonjour,
j’ai une tableModel dans une JTable qui contient pas mal de lignes, j’ai mis en place un système de tri sur les colonnes, ainsi qu’un système de focus sur la ligne sur laquelle j’étais avant de faire mon tri. ça marche, maintenant j’ai mis en place un système pour remettre l’ascenseur à la bonne place en utilisant ce code :


// Assumes table is contained in a JScrollPane.
  // Scrolls the cell (rowIndex, vColIndex) so that it is visible
  // at the center of viewport.
  public void scrollToCenter(JTable table, int rowIndex, int vColIndex) {
 if (! (table.getParent()instanceof JViewport)) {
   return;
 }
 JViewport viewport = (JViewport) table.getParent();

 // This rectangle is relative to the table where the  northwest corner of cell (0,0) is always (0,0).
 Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);

 // The location of the view relative to the table
 Rectangle viewRect = viewport.getViewRect();

 // Translate the cell location so that it is relative
 // to the view, assuming the northwest corner of the view is (0,0).
System.out.println("scrollToCenter "+(rect.x-viewRect.x)+" " +(rect.y-viewRect.y));
 rect.setLocation(rect.x - viewRect.x, rect.y - viewRect.y);

 // Calculate location of rect if it were at the center of view
 int centerX = (viewRect.width - rect.width) / 2;
 int centerY = (viewRect.height - rect.height) / 2;

 // Fake the location of the cell so that scrollRectToVisible
 // will move the cell to the center
 if (rect.x < centerX) {
   centerX = -centerX;
 }
 if (rect.y < centerY) {
   centerY = -centerY;
 }
System.out.println("scrollToCenter "+centerX+" " +centerY);
 rect.translate(centerX, centerY);

 // Scroll the area into view.
 viewport.scrollRectToVisible(rect);
  }

ça marche aussi, mais quand il y a énormément de lignes dans ma table, le refresh ne se fait pas bien, et la table est mal rafraîchie, il y a plus ou moins des lignes qui se chevauchent, je dois donc baisser ma fenêtre puis la réagrandir pour bien tout voir.
J’ai essayé de faire un fireTableDataChanged() sur ma tableModel, mais ça ne marche pas, je perd complètement mon focus …
Si qqu’un a une idée …
Merci d’avance

C’est bon, j’ai trouvé,
au lieu d’utiliser fireTableDataChanged() sur la tableModel,
j’utilise updateUI() sur la table

Par contre, j’ai un problème avec l’updateUI(), j’ai une exception : nullPointer
javax.swing.plaf.basic.BasicTableUI.paintCell
J’ ai un peu cherché sur le net, et ce que j’ai trouvé comme esquisse de réponse, c’est qu’il y aurait un autre thread en train de faire des traitements dans ma table en même temps que je lance l’updateUI() , mais je ne vois aucun moyen de fixer ce pbme … Help please …