Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the mouse cursor for a particular JTable cell

I have a JTable with a set of uneditable cells and I want all the cells in a particular column to have a different mouse cursor displayed whilst the mouse is hovering over them. I am already using a custom renderer and setting the cursor on the renderer component doesn't seem to work (as it does for tooltips).

It does seem to work for editors.

Is this not possible in JTable when your cell is not being edited or am I missing something?

like image 411
Tom Martin Avatar asked Apr 07 '09 19:04

Tom Martin


1 Answers

Add a MouseMotionListener to the JTable and then on mouseMoved() determine which column it is using JTable's columnAtPoint() and if it's the particular column you are after, setCursor() on the JTable.

like image 105
Kevin Herron Avatar answered Oct 12 '22 08:10

Kevin Herron