my dog learned polymorphism
The moose likes Swing / AWT / SWT and the fly likes Hierarchical structure using swings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Hierarchical structure using swings" Watch "Hierarchical structure using swings" New topic

Hierarchical structure using swings

Nikhil Nagrani

Joined: Dec 23, 2010
Posts: 24
Hey i got the assignment to make a binary tree like structure(hierarchical).it's basically a hierarchical organizational structure type of GUI which i need to make and it should fuction like...when i make a change to the child node it should be reflected in the parent node.(linking should be there i.e using buttons,lines etc)

To do this i have started learning swings but the thing is i need to submit it very soon.So i m a bit confused and need your suggestions?

1)Should i go for netbeans as it has swing components added?
2)Should i read specific topics of swings to make this GUI?
3)Or any other SWING gui making tool.

Please help me out regarding the same...
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46320
It's not called swings.

I am not quite sure I understand the question, but whether you should use NetBeans or another automated tool: no. You will get code which you can't understand, and you won't learn anything from it. What's more, if you hand it in for marks, you won't get any marks for code you didn't actually write yourself.
I would suggest you read about trees. Try Wikipedia, Niklaus Wirth's algorithms book, which you can download free of charge, or lots of other sources and resources which you will doubtless find and I can't think of just at the moment.
I think you might do well to design TreeNode classes which have a Swing JComponent and their parent node as fields. That is in addition to the usual child node fields.
I am not sure I can make any more suggestions at present.
Nikhil Nagrani

Joined: Dec 23, 2010
Posts: 24
Thanks Campbell for your reply.

I would like to explain with the example my query.

Refering to attached file:-

I have to make the structure(hierarchical) like the one shown in the file attached.

Now what is to be done is that i would be having a excel database whose values should be populated(as manager should be first,then below it should be leads and below that members of the team) in the button boxes(which need to be made dynamically).

Let's say i change in the excel sheet "Copy Editor" to "C++ developers" then it should change in the GUI too.Such linking should be there.(dynamically as mentioned above).

This is all that i need to do.

Please guide me regarding the same and how to approach the same.

[Thumbnail for Sample_data.gif]

I agree. Here's the link:
subject: Hierarchical structure using swings
jQuery in Action, 3rd edition