The JTable I use displays panels with several componets in it to display a spcialized data type.
Now I would like to use f.e. PopUp menus or the ToolTip property for the components.
The problem is, that as long a line is not selected (using left click. right click and setRowSelectionIndex don't work), the included components don't get any event.
Now one might say that I should simply check, over wich component the mouse pointer is. The problem here is, that the mouse events received by the table are not really useful. getSource() and getComponent() deliver of course the table, but the mouseposition is relative to the top component, not to the table. If that is not weird enough, here is another: the panels and inner components used to display the cells have no useful size (x = 0, width = -195, ...), until the cell is selected.
And for last: What must I do to reallly select a line without left clicking on it (even right clicking doesn't work)? If I use setRowSelectionInterval, the line get's selected, but It still doesn't get any Mouse Events, first I have to click on it. I tried different uses of grabFocus and requestFocus without success.
If anyone can help me with any of the problems, ...
I wrote my own TableCellRenderer and TableCellEditor class. getTableCellEditorComponent and getTableCellRendererComponent return the correct panel as a result.
I just noticed something interesting. (I first wrote a long text, but could hardly read it myself, so here is the short version)
1.) row 2 selected (with left click, setRowSelectionInterval does not activate event handling). 1.1) moving the mouse over row 1: small dot over button[2] 1.2) moving the mouse over row 2: Tooltip over button[2] 1.3) moving the mouse over row 3: small dot over button[3] 1.4) rightclick on a component in row 1: table gets event 1.5) rightclick on a component in row 2: component gets event 1.6) rightclick on a component in line 3: table gets event
the small dot from 1.1 appears on the right relative location to the button, but on the wrong row.