DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2006

    Post adding different popupmenus to different tree nodes

    I am new to swing and I would like to add different popupmenus for different nodes of a tree. Can we do this using tree mouse listeners or tree model listeners ?

    I've an application which constructs a jtree initially. Once the jtree is created, I am adding a custom mouse listener to jtree. In my custom mouse listener if the event is a popup trigger, I'm displaying a popup menu for the selected node. I've different action classes for each of the popup menu actions. In once of the action classes, a new node is inserted to the tree. After the node is added, I would like to display a different popup menu to the new node. As of now, I am still able to see the old popupmenu used for the tree initially. I think this can be done as this is a normal thing for anybody using jtrees.

    I would really appreciate if anyone can guide me out or give some idea of doing this.


  2. #2
    Join Date
    Mar 2004
    Are we talking popup menu as in like right-clicking to bring up a menu?
    Either way, inside the listener you should grab the node that was clicked. Determine the type or status of the node and then show the appropriate menu.

  3. #3
    Join Date
    Sep 2006
    Thanks for your reply. I solved the problem.

Similar Threads

  1. Dynamic tree view control
    By anbaz in forum ASP.NET
    Replies: 2
    Last Post: 06-15-2005, 09:09 PM
  2. Adding nodes dynamically ???
    By serge calderara in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 10:47 AM
  3. Adding Nodes to an Exiating XML Tree Structure
    By Vaibhav Modak in forum XML
    Replies: 0
    Last Post: 05-07-2003, 06:03 AM
  4. Adding to a Tree View
    By Jay King in forum .NET
    Replies: 8
    Last Post: 07-11-2001, 11:02 AM
  5. Adding Nodes
    By Colin in forum XML
    Replies: 1
    Last Post: 01-16-2001, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.