Usage

Top  Previous  Next

 

You can create a CheckBoxTree just as you create a normal JTree. For example:

 

CheckBoxTree tree = new CheckBoxTree(new Object[]{"one", "two", "three"});

 

or

 

CheckBoxTree tree = new CheckBoxTree(new DefaultTreeModel());

 

The CheckBoxTreeSelectionModel is retrieved and assigned respectively with:

 

public CheckBoxTreeSelectionModel getCheckBoxSelectionModel();

public void setCheckBoxSelectionModel(CheckBoxTreeSelectionModel checkSelectionModel);

 

You can also change the gap that exists between the checkbox and the node's value with the method:

 

public void setCheckBoxGap(int checkBoxGap);

 

CheckBoxTree can also be assigned to a TreeTable:

 

CheckBoxTree tree = new CheckBoxTree();

TreeTable table = new TreeTable();

table.getTreeTableModelAdapter().setTree(tree);