Ciao a tutti,

sto realizzando un ftp Client usando due JTable una lato Host e l'altra per il compiuter client,
avrei la necessità al passaggio del mouse all'interno delle jTable di evidenziare le righe visto che i dati sono parecchi.
Questa discussione è già stata affrontata in qualche post precedente ma vorrei innanzitutto capire quale evento si deve implementare un mouseProcessMotionEvent, od un mouseMoved.
Le tabelle, per comodità di disegno, sono state inserite nel mio frame usando netBeans.
Il codice postato nella discussione precedente è perfettamente funzionante così com'è ma non riesco ad adattarlo alla mia applicazione.
Se inserisco un metodo mouseProcessMotionEvent come lo implemento dalla mia jTable:

di seguito quello che è stato postato precedentemente e perfettamente funzionante:

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;

/**
*
* @author Andrea
*/
public class ColorRows extends JFrame {

private class MyJTable extends JTable {

private final Color rowhlcolor;

private int highLightedRow = -1;
private Rectangle dirtyRegion = null;

protected void processMouseMotionEvent(MouseEvent e) {
int row = rowAtPoint(e.getPoint());
boolean highlighted = false;

Graphics g = getGraphics();

// row changed
if(highLightedRow != row) {
if(null != dirtyRegion) {
paintImmediately( dirtyRegion );
}
for(int j = 0; j<getRowCount(); j++) {
if(row == j) {
//highlight
Rectangle firstRowRect = getCellRect(row, 0, false);
Rectangle lastRowRect = getCellRect(row, getColumnCount() - 1, false);
dirtyRegion = firstRowRect.union(lastRowRect);
g.setColor(new Color(rowhlcolor.getRed(), rowhlcolor.getGreen(), rowhlcolor.getBlue(), 30));
g.fillRect( (int)dirtyRegion.getX(), (int)dirtyRegion.getY(),
(int)dirtyRegion.getWidth(), (int)dirtyRegion.getHeight() );
highLightedRow = row;
}
}
}
}

public MyJTable(Object[][] data, Object[] columnNames, Color rowhlcolor ) {
super(data, columnNames);
this.rowhlcolor = rowhlcolor;
}

}

public ColorRows() {
super("Another test");
Object[][] data = {
{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)}
};
String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
MyJTable myTable = new MyJTable(data, columnNames, Color.red);
this.getContentPane().add(new JScrollPane(myTable), BorderLayout.CENTER);
this.setSize(400,400);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );

}

public static void main (String[] args) {
new ColorRows();
}

}