Thursday, January 19, 2012

How detecting whether a JTable cell has the focus?

boolean rowIsAnchor = (getSelectionModel().getAnchorSelectionIndex() == row);
boolean colIsAnchor =
    (getColumnModel().getSelectionModel().getAnchorSelectionIndex() == column);