The paint method of JComponent calls paintComponent, paintBorder
and paintChildren.   The container that holds the two trees will
call paintChildren, which will cause the trees to be painted.
So I'd think if you override the paint method of the container, and
put your drawing code *after* the call to paintChildren, then the
arrow will appear on top of the two trees.
Eg.,

public void paint(Graphics g)
{
   paintComponent( g)
   paintBorder(g)
   paintChildren(g)
   // insert drawing code here.
}

You'd need to subclass your container to override this method.   You'd
call repaint on the container when the node finishes dragging.

--Kurt

>From: Deepesh Bhar <[EMAIL PROTECTED]>
>Subject: Connection from one tree node to another
>To: [EMAIL PROTECTED]
>
>Hello All,
>
>I am trying to develop a UI that has 2 panes showing
>JTrees. I want such a functionality that if a user
>drags a node from one tree to another then an arrow
>should be drawn from the dragged tree node to the node
>where node was dropped. The intension is not to cut
>the node and paste on other end but only to show that
>these tree node are connected. This should only be
>possible between two different tree nodes and should
>not be affected if tree is resized.
>
>Does anyone has any pointers or code snippets to help
>me out??? I am kinda stuck here.
>
>
>Thanks in advance
>Dennis
>


_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to