Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tooltips in a cell  RSS feed

 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to set a tooltip in each individual cell in a table, the cells that are editable display the tooltip fine, the cells that are disabled don't. Is there anyway to get the tooltip to display even on the disabled cells?

here is my current code:



Thanks.
 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Override this method in your JTable.

getToolTipText(java.awt.event.MouseEvent)
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but im a little confused on how this method will work, because the only method i am currently using is:



And its not in the jtable, is getToolTipText(java.awt.event.MouseEvent) a default method used by the table? Sorry i'm confused.

Thanks
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how is the event used?

thanks.
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Read it and help me a bit, but i am still very confused, i can create a normal Jtable and add the tooltips to it, but the program that i am working on uses a 1 model where everything is dynamic. The tooltips are kept in the xml & the text-fields & combo-boxes are kept in separate classes.
I have tried adding the relevant code to different places, but it only seems to work in the class where the text-fields(does not extend JTable) are kept & only if they active.

If anyone has any suggestions or if i misunderstood the article please let me know.

Thanks.
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, its now adding the tooltips to every cell the table, but whenever i try to add the dynamic tooltips(from xml) then my table doesn't appear and i get a java.lang.nullPointerException although there is data in the xml and it does fetch it in another class & it is called exactly the same way.

Any ideas? Thanks
 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hoh,



Beknown that I have invidual row and cell classes in my table model.

[ December 19, 2008: Message edited by: Mikko Kohtam�ki ]
[ December 19, 2008: Message edited by: Mikko Kohtam�ki ]
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mikko
 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, well my last post may be a bit confusing. Please tell if you have still problems with this
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k will do, thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!