🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8443

JTree

#8443
From: Hycel
Date: Sat, 19 Aug 2000 00:00
45 lines
2127 bytes
Hello,

I believe I have a simple problem.  I have created a JTree and inserted into
a JFrame.  Two of it's functions are  Copy and Move.  Both work properly on
the JTree itself but neither show the results visibly with in the JFrame.
The first time I Copy a node to another node, the result of the copy will
show up on the JTree. The next time I Copy to that same node, the results
will not show up in the JFrame.  I have to rebuild the JTree in order to see
the results of the copy.  The same thing happens when I Move one node to
another node, except it doesn't even show the results the first time.  Again
I have to rebuild the JTree in order to see the results of the move.

Question:

Does anyone know the proper sequence of commands to tell a given node how to
re-expand itself an show all of it's children nodes, even newly added ones,
on a JTree, with in a JFrame?

Below is the block of code that moves on node to another node.

 // Keeps track of the current selected DefaultMutableTreeNode.
 protected DefaultMutableTreeNode selectedJTreeNode;

 Action moveAction = new AbstractAction("Move"){
    public void actionPerformed(ActionEvent e){
      if (aNodeSelected = true)
       return;
     else
     {
       try{
         TreePath movePath = jTree.getLeadSelectionPath();
         DefaultMutableTreeNode jTreeNode = (DefaultMutableTreeNode)
jTree.getLastSelectedPathComponent();
         selectedJTreeNode.setParent(jTreeNode);
         jTree.expandPath(movePath);
         jTree.repaint();
       }
     }
   }
 }

Thank you to any one who can offer any concrete help.

Hycel
hycel@mediaone.net
Technical Details
Message-ID: <8nm0g8$4i07@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1a6f7304dd699a42,start
X-Google-Attributes: gid111d45,public
From: "Hycel" <hycel@mediaone.net>
Subject: JTree
Date: 2000/08/19
Message-ID: <8nm0g8$4i07@bornews.borland.com>
X-Deja-AN: 660069656
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing