tool tip for check box tree node

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.

tool tip for check box tree node

Postby RajaRajeswari_V » Wed Jul 15, 2009 9:47 am

Hi,

is it possible to add the tooltip for each node of check box tree.
RajaRajeswari_V
 
Posts: 25
Joined: Tue Apr 28, 2009 8:33 pm

Re: tool tip for check box tree node

Postby JIDE Support » Wed Jul 15, 2009 10:09 am

Please try override JTree#getToolTipText(MouseEvent). Please read the javadoc first to avoid a trick.

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

Re: tool tip for check box tree node

Postby hemna » Mon Feb 07, 2011 1:34 pm

Any examples of this?
hemna
 
Posts: 37
Joined: Wed Jul 29, 2009 10:27 am

Re: tool tip for check box tree node

Postby JIDE Support » Mon Feb 07, 2011 1:52 pm

Sorry that our sample project could not cover every single feature. Can you please give the solution a try? Let us know if you encounter any issue.

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

Re: tool tip for check box tree node

Postby hemna » Mon Feb 07, 2011 2:01 pm

I'm not sure what "Solution" you are mentioning here.

I have my own DefaultTreeCellRenderer that I'm calling setToolTipText("something here") and I'm not seeing any tooltips when I mouse over the node in the CheckBoxTree
hemna
 
Posts: 37
Joined: Wed Jul 29, 2009 10:27 am

Re: tool tip for check box tree node

Postby JIDE Support » Mon Feb 07, 2011 2:19 pm

Please give this solution a try.

JIDE Support wrote:Please try override JTree#getToolTipText(MouseEvent). Please read the javadoc first to avoid a trick.

Thanks,


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

Re: tool tip for check box tree node

Postby hemna » Mon Feb 07, 2011 2:31 pm

Thanks for the completely useless reply. I can clearly read the first time you guys posted that comment. It was a useless comment then, and the second time it's still useless.

I've googled for several methods for getting a tooltip text for nodes to show up and it seems the most common method is to do what I've done. call setToolTipText inside my own renderer, but that isn't working.

Code: Select all
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
            boolean expanded, boolean leaf, int row, boolean hasFocus) {
         
         Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
         if (value != null) {

            if (value instanceof DefaultMutableTreeNode) {
               DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
               Object o = node.getUserObject();
               if (o instanceof MyCustomObj) {
                  MyCustomObj def = (MyCustomObj) node.getUserObject();
                  setText(def.getName() + " : " + def.getVersion());
                  setToolTipText(def.getName());
               } else {
                  setToolTipText((String) o);
               }
            }                                   
         }
         return c;
      }


My calls to setToolTipText() are called with non null Strings, but they still don't show up when I mouse over.

If you can provide something more useful, say a url that could attempt to show how to properly do this, that would be great.
hemna
 
Posts: 37
Joined: Wed Jul 29, 2009 10:27 am

Re: tool tip for check box tree node

Postby hemna » Mon Feb 07, 2011 2:45 pm

Ok I figured it out. I hadn't registered the checkboxtree with the tooltip manager...

ToolTipManager.sharedInstance().registerComponent(checkboxtree);
hemna
 
Posts: 37
Joined: Wed Jul 29, 2009 10:27 am

Re: tool tip for check box tree node

Postby JIDE Support » Mon Feb 07, 2011 2:48 pm

Thanks for trying and sharing.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
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 63 guests