How to expand only leaf nodes with property red_color = true of jtree

I have a jtree with green leaf nodes and reds leaf nodes by implementing a custom CellRenderer.

i am doing this to expand the entire jtree:

expAll.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    for (int i = 0; i < jTree1.getRowCount(); i++) {

but How to create a action to programatically expand my jtree to only leaf nodes that have Red cells?

Leave a Reply

Your email address will not be published. Required fields are marked *