1

File Explorer Image:

I was making a file explorer in Java and in the given image I manage to generate the output a JTree on the left side, which expands and collapses, and a JTable on the right side.

But as we experience in the Windows Explorer, if we click any folder in the table it expands and shows its contents. In my file explorer, how can I implement it--> If I click the row and if it is a directory/folder then it would expand and shows its contents?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
sphoenix
  • 3,327
  • 5
  • 22
  • 40
  • 1
    See the [File Browser GUI](http://codereview.stackexchange.com/q/4446/7784) for an example to work from. – Andrew Thompson Apr 15 '17 at 18:30
  • I viewed that example. But in that example, when I want to expand a folder from the table, I have to click it and from the bottom, I have to click "open", which opens the folder in the default file explorer of the system. – sphoenix Apr 15 '17 at 18:35
  • Have you tried adding a `MouseListener` to the `JTable`? – MadProgrammer Apr 15 '17 at 22:25
  • See also `org.netbeans.swing.outline.Outline` illustrated [here](http://stackoverflow.com/a/16410632/230513). – trashgod Apr 16 '17 at 04:23

0 Answers0