Re: Need help with a viewToModel() problem in a JTable



Gerald Rosenberg <No@xxxxxxxxxxx> wrote:

> In article <1T2b0ms0IurhNmc0@xxxxxxxxxxx>, usenet@xxxxxxx says...
>> Gerald Rosenberg <No@xxxxxxxxxxx> wrote:
>> > I have a JTable with a column that is rendered using a JTextPane-based
>> > cell-renderer.
>> >
>> > On a single click on that column in the JTable, I would like to
>> > determine the text offset of the click in the row under the user click.
>> >
>> > I thought the code below would work, but the viewToModel() method fails
>> > since the renderer is not actually visible -- internal to the
>> > viewToModel() method, the rectangle that contains the rootView is null,
>> > which causes the method to return -1.
>> >
>> > Can't see a workable way of forcing a visible renderer on a mouse click.
>> > Am I missing something or is there an alternate/better way of doing
>> > this?
>>
>> Use a TableCellEditor.
>
> Thanks, but could you explain your suggestion.


http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender


Christian
.