I’m currently writing a custom TableCellRenderer
using a JEditorPane
as cell-component for a JTable
. I want to make hyperlinks clickable in that component.
Therefore, I wrote a tiny hack that forwards mouse events that are fired on the Table to the specific component. The problem is, that I cannot use the viewToModel
function of the JEditorPane
to determine the text under the mouse cursor, because the size of my editor pane is always zero and therefore viewToModel
always returns -1.
Is there any way to get the components rendered in the table’s cells to have their correct sizes set? Do you have any suggestions on doing it in another way?
Some side information: I cannot use JTextPane
since I'm using the scala programming language and there is currently no implementation for it. Furthermore, I have read that it may be possible to use the native event implementation by using custom cell editors. But I could not get this working in the first place. I want that, for instance, links are highlighted by hovering over. But, as far as I can see, that is not possible with the cell editor approach, since you have to click at the cell to start editing first.