How do I auto-expand a JTree when setting a new TreeModel?

后端 未结 5 1170
抹茶落季
抹茶落季 2020-12-18 19:37

I have a custom JTree and a custom JModel; I would for the JTree to \"auto-expand\" when I give it a new model. At the moment, it simply collapse a

5条回答
  •  再見小時候
    2020-12-18 20:28

    The following worked for me (called after setting the new model):

    for (int i = 0; i < tree.getRowCount(); i++) {
        tree.expandRow(i);
    }
    

提交回复
热议问题