Tooltip for a table cell

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Tooltip for a table cell

Postby pp_dv » Mon Dec 01, 2008 8:31 am

Hello,

I have a table which uses a table model, a subclass of AbstractMultiTableModel. I would want to set tool tips for these cells if the data is truncated.

I cannot add a mouse listener nor can I implement the CellRenderer as I won't have the method setToolTip in the context of the class in either case.

Also I cannot override the getToolTip(MouseEvent e) of JTable as I dont have a table and also that method would set the tooltip for a table but not for a particular cell.

Is there something available in the jide demos to implement this functionality? Or is there a way that I can implement this may be using AWT alone?
pp_dv
 
Posts: 5
Joined: Thu Nov 06, 2008 6:26 am

Re: Tooltip for a table cell

Postby JIDE Support » Mon Dec 01, 2008 8:37 am

You can at least override getToolTip and use rowAtPoint and columnAtPoint to find out which cell the mouse is on then find out the correct tooltip to return in getToolTip method. In fact, ideal way is to use cell renderer to do it in JTable. I am not sure why you said you can't do it that way.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: Tooltip for a table cell

Postby pp_dv » Thu Dec 04, 2008 8:25 am

I dont have a reference to the Jtable within my tablemodel. That is why I cannot use the getToolTip or rowAtPoint method. Also that is the reason why I cannot implement using a cell renderer (I wont have the reference to JTable in that case as well.).
pp_dv
 
Posts: 5
Joined: Thu Nov 06, 2008 6:26 am

Re: Tooltip for a table cell

Postby JIDE Support » Thu Dec 04, 2008 9:18 am

I don't understand though. Why you need JTable in your table model. I didn't ask you to implement it in your table model. My first suggestion is to ask you to implement on your JTable. In cell renderer, there is table passed as parameter to getTableCellRendererComponent method so you do have access to JTable.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 11 guests