Here's an event-oriented solution. Another (untried) possibility is to write a cell renderer and, for the empty cells, do not show any changes for selection or focus. The cell would continue to be both selected and the focus owner; you just would not have any visual indication. Or, you could do both. Even tough this (event) approach removes the focus, the cell renderer still seems to consider the cell to have focus: cover and uncover the table to see the restored appearance-of-focus. Press the tab key to remove it.
Nicholas van Orton
Joined: Aug 13, 2005
I see what you mean, this may just be a limitation on using a JTable?
Is there anyway to use the removeMouseListener() method on a JTable cell?
Joined: Jan 14, 2004
this may just be a limitation on using a JTable? possibly Is there anyway to use the removeMouseListener() method on a JTable cell? Not exactly. But you could try something creative as an alternative. I tried overriding processMouseEvent in the JTable and it seemed to work but every now and then it failed. I was unable to find out who was getting around the processMouseEvent method.
Then I tried a GlassPane and it seems to work okay.