Disabling/Hiding CheckboxTree

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

Disabling/Hiding CheckboxTree

Postby thegame1921 » Mon Dec 17, 2007 8:02 am

The program I am working on has recently switched from a JTree to a JIDE checkbox tree. The tree is only 3 levels deep with the first being the root which is hidden in the GUI.

What I'm looking to do is somehow stop users from selecting a node at the second level if that node has no children. I was wondering if there is some way to either hide the checkbox for that node or disable it so the user cannot select it.
thegame1921
 
Posts: 2
Joined: Mon Dec 17, 2007 7:50 am

Postby JIDE Support » Mon Dec 17, 2007 8:33 am

You can override isCheckBoxVisible method and return false for TreePath that you don't want to show the check boxes.

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

Postby thegame1921 » Mon Dec 17, 2007 9:07 am

I have tried this but it doesn't seem to be working for me. Where should it be overridden at? The node? CellRenderer? None of the above?
thegame1921
 
Posts: 2
Joined: Mon Dec 17, 2007 7:50 am

Postby JIDE Support » Mon Dec 17, 2007 9:08 am

Its method on CheckBoxTree.

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

Postby naseh11 » Thu Jul 31, 2008 2:23 am

Thanks for the support. it helps me alot.

To hide checkbox from all nodes except leaf ones:

CheckBoxTree tree = new CheckBoxTree(new DefaultTreeModel(rootNode))
{
public boolean isCheckBoxVisible(TreePath path)
{
return(((TreeNode)path.getLastPathComponent()).isLeaf());
}
};
naseh11
 
Posts: 3
Joined: Fri Jul 11, 2008 9:08 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 12 guests

cron