defaultmutabletreenode

JTree avoid collapse after reload

孤者浪人 提交于 2019-12-20 06:39:42
问题 I'm trying to find a solution the problem of collapse in JTree after reload it. The situation: JTree [-] Office A |---[-] Office A.1 | |---[-] Office A.1.1 | |---[-] Office A.1.2 [-] Office B |---[-] Office B.1 | |---[-] Office B.1.1 | | |---[-] Office B.1.1.1 Now I have to add the Office A.1.3 . To do this I get the Office A.1 and with the method add(DefaultMutableTreeNode aNode) I add Office A.1.3 . OfficeA1.add(OfficeA13); After this I call the reload method on the DefaultTreeModel of the

get nested List of CustomObject from JTree, including leaf

寵の児 提交于 2019-12-13 17:24:02
问题 Get List<List<CustomObject>> from JTree I was populating the JTree according to this question... Recursively populate JTree, using list of list using the Answer https://stackoverflow.com/a/56090968/7339033 List<List<Pair>> listOfListPair = new ArrayList<>(); listOfListPair.add((List<Pair>) Arrays.asList( new Pair[]{new Pair(1, 1), new Pair(3, 1), new Pair(1, 2)})); listOfListPair.add((List<Pair>) Arrays.asList( new Pair[]{new Pair(1, 1), new Pair(3, 1), new Pair(3, 1)})); listOfListPair.add(