***j'ai essaye ta methode mais ca marche tjrs pas!!! :(


Salut,
Pour scroller au row specifi�:
/**
    * Scroll to the specified row in the table.
    * @param The row in table that is to be in scroll viewport.
    */
   public void scrollTo( int anIndexIntable ){

      Rectangle theCellRectangle = theTable.getCellRect(anIndexIntable, 0,
true);
      Rectangle theViewRectangle =
theScrollPane.getViewport().getViewRect();

      if ( theCellRectangle.y + theCellRectangle.height >
theViewRectangle.y
+ theViewRectangle.height ||
           theCellRectangle.y < theViewRectangle.y ){

         int theTableHeight = theFrameContainer.theTable.getHeight();
         // it scrolls to table down limit
         if ( theCellRectangle.y > theTableHeight -
theViewRectangle.height ){

theFrameContainer.theScrollPane.getViewport().scrollRectToVisible( new
Rectangle( theViewRectangle.x, theTableHeight + theCellRectangle.height -
theViewRectangle.height, theViewRectangle.width,
theViewRectangle.height ) );
         }
         // it does not scroll to table down limit



heFrameContainer.theScrollPane.getViewport().setViewPosition( new
oint( theViewRectangle.x, theCellRectangle.y ) );
         }

      ( ( AbstractTableModel ) theTable.getModel() ).fireTableDataChanged
();
      }

   }

Beno�t

Répondre à