I was looking for a a JTree implementation, that contains checkboxes and which:
When you select one node, all its successors in the tree are automatically s
Can be solution without map structure.
MouseAdapter ml = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if ( e.getClickCount() == 1 )
{
TreePath selPath = m_xTree.getPathForLocation(e.getX(), e.getY());
if(selPath==null) return;
else if (selPath!=null && selPath.getPathCount()>=1)
{
DataItem xDIClicked = (DataItem)( selPath.getPathComponent(selPath.getPathCount()-1) );
xDIClicked.setIsSelectedByCheckbox( !xDIClicked.getIsSelectedByCheckbox() );
m_xTree.repaint();
}
}
}
};
m_xTree.addMouseListener(ml);
So xDIClicked returned by getPathComponent() is JTree Model's data item. And each DataItem contains checked property.