1 Replies - 1015 Views - Last Post: 30 December 2009 - 07:24 AM Rate Topic: -----

#1 zed420   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 22-December 09

A question about JTree

Post icon  Posted 30 December 2009 - 04:45 AM

Hi All
I'm trying to create JTree of folders. Below I've got good example from net but how would I display the file . How to get to the path of a file ??? E.g. Like you would in HTML click on link and in displays in the centre of page or where ever.
Many Thanks
Zed

DefaultMutableTreeNode root =
	  new DefaultMutableTreeNode("Root");
	DefaultMutableTreeNode child;
	DefaultMutableTreeNode grandChild;
	for(int childIndex=1; childIndex<4; childIndex++) {
	  child = new DefaultMutableTreeNode("Child " + childIndex);
	  root.add(child);
	  for(int grandChildIndex=1; grandChildIndex<4; grandChildIndex++) {
		grandChild =
		  new DefaultMutableTreeNode("Grandchild " + childIndex +
									 "." + grandChildIndex);
		child.add(grandChild);
	  }
	}

This post has been edited by zed420: 30 December 2009 - 05:25 AM


Is This A Good Question/Topic? 0
  • +

Replies To: A question about JTree

#2 NeoTifa   User is online

  • NeoTifa Codebreaker, the Scourge of Devtester
  • member icon





Reputation: 4390
  • View blog
  • Posts: 18,828
  • Joined: 24-September 08

Re: A question about JTree

Posted 30 December 2009 - 07:24 AM

Here, in this tutorial they so the same thing that I'd imagine you're doing. Check out the source for loading the actual page. ^__^
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1