Terai Atsuhiro 2021-11-18 (木) 11:29:54

http://terai.s55.xrea.com/swing/cellhighlight/screenshot.png

public void mouseMoved(MouseEvent me) {
  Point pt = me.getPoint();
  int nrow = table.rowAtPoint(pt);
  int ncol = table.columnAtPoint(pt);
  AbstractTableModel model = (AbstractTableModel)table.getModel();
  if(nrow<0 || ncol<0) {
    nrow = row;
    ncol = col;
    row = -1;
    col = -1;
  }else{
    int trow = row;
    int tcol = col;
    row = nrow;
    col = ncol;
    model.fireTableCellUpdated(trow, tcol);
  }
  model.fireTableCellUpdated(nrow, ncol);
}