Results 1 to 2 of 2
  1. #1
    kholostoi is offline Member
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Default How to: draw line between 2 nodes of 2 trees

    I have 2 JTree on 2 JScrollPane. Now I need to draw a line from one selected node in the right tree to one in the left tree with the same name (node's name).
    I do not know how to draw line between 2 components like that. Could you give me some advices?

    I saw this technique in the COMA++ system. I attach a picture from that for more understandable:

    h t t p : //img168.imageshack.us/img168/3746/coma.jpg

    (sorry, I can up the image since I do not have enough posts)

    I will appreciate for any help. Thank you very much :)

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Seems like you would need to have a transparent panel that covers both JScrollPane's and then draw lines on the transparent panel. You would have to make sure the covering panel doesn't eat all the mouse and keyboard events and you would have to figure out the positioning and linking of the lines and communicate it with that panel.
    Last edited by mrmatt1111; 09-03-2009 at 08:18 PM.
    My Hobby Project: LegacyClone

Similar Threads

  1. When do we draw the line for loose coupling.
    By h8alfred in forum Advanced Java
    Replies: 0
    Last Post: 03-27-2009, 04:05 AM
  2. Need help with Trees...(8-puzzle)
    By ventrue in forum New To Java
    Replies: 2
    Last Post: 03-24-2009, 12:04 AM
  3. Help With Tournament Trees
    By wiggsfly in forum New To Java
    Replies: 2
    Last Post: 10-26-2008, 10:38 PM
  4. How to Draw line in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 12:08 AM
  5. How to draw a thick line
    By johnt in forum Java 2D
    Replies: 1
    Last Post: 05-31-2007, 05:27 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
  •