1. Display content of zip in JTree? coderanch.com |
2. How to display content og ZIP in JTree? coderanch.com |
3. zip to JTree coderanch.comI assume you know how to read all entries in a Zip file. I would keep a mapping from entry names to DefaultMutableTreeNodes. Then, when you encounter a ZipEntry, you determine its parent from the name (using the / as the separator*). You retrieve the parent node from the map, creating it if necessary. Then you create a DefaultMutableTreeNode, and add ... |
4. zip to JTree java-forums.orgFinally, I found a possible solution: public TreeNode generarArbre() { ZipFile file = null; try { file = new ZipFile(ruta); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); System.exit(1); } MutableTreeNode arrel = new DefaultMutableTreeNode(nomFitxer); Map |