Hi Kurt,

My main problem is to draw a line from source node to
target node. 
To draw a line I need start and end coordinates of the
source and target nodes respectively. How do I get the
coordinates of each node????
When I resize the window then again the coordinates
have to be calculated to paint lines for each
connected tree node.

All thoughts are welcome????

Thanks
Dennis


--- Kurt Baumgarten <[EMAIL PROTECTED]>
wrote:
> 
> 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


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to