Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes How to add different menuitems to child node Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to add different menuitems to child node" Watch "How to add different menuitems to child node" New topic
Author

How to add different menuitems to child node

sudhakar cheru
Greenhorn

Joined: Sep 11, 2009
Posts: 3
Hi All,
I have 2 Swing files 1 is Sync7000_SubChildConfTool.java (main file) and 2nd file is SerialPortSubChild.java. After running the main file SYNC7000 (root node) will display. If i right click on this root node i am getting 4 menu items (Add Serial Channel, Add Optical Channel, Add TCP/UDP Channel, Add Modem Channel) in popup. If i right click on that particular menu item then SerialPortSubChild file will open and after filling this frame i am getting Child node. It is fine up to now. But my problem is if i right click on particular Child node i want to display the menu items like Add Polling Group, Edit Channel, Delete Channel in the popup. Please anyone help me.



Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Sudhakar,
Welcome to the Ranch.

Very few people if any, will want to try out ~500+ lines of code to find out the solution. The preferred way is for you to post a sscce code which demonstrates your problem.
While you are at it, it might also be a good idea for you to read this.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
just going by your description, a solution might be to add all the menuitems to the popup,
then when a node is clicked, if that node does not meet your criteria for edit/delete etc,
set those extra items disabled, or visible(false). note that if you're using mouseListeners,
they'll still fire on disabled items.

[edit]

I'm getting totally fed up with these inconsiderate cross-posters

http://www.java-forums.org/awt-swing/21193-how-add-different-menuitems-child-node.html

personal ignore list +1
sudhakar cheru
Greenhorn

Joined: Sep 11, 2009
Posts: 3
Thank you All,

My Problem is Solved.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Thanks Michael.

Sudhakar,
Please read http://faq.javaranch.com/java/BeForthrightWhenCrossPostingToOtherSites
sudhakar cheru
Greenhorn

Joined: Sep 11, 2009
Posts: 3
Thanks Maneesh,

This is my first experience.
 
Don't get me started about those stupid light bulbs.
 
subject: How to add different menuitems to child node