Java JTree directory structure from file paths
问题 I\'ve been trying to get my head around this so maybe some of you can help me. I have a list of files with their full paths (these are just strings the files are on another machine), e.g: C:\\a\\b\\c\\file1.txt C:\\a\\b\\c\\file2.txt C:\\a\\d\\file3.txt C:\\e\\file4.txt I want to create a Jtree to show the directory structure like this: C: a b c file1.txt file2.txt d file3.tct e file4.txt I\'ve been spliting the string on the seperator so I end up with a list of arrays like: \"C:\",\"a\",\"b\