JTree display "freeze" object values possible?

Discussion in 'Java' started by Sam, Jun 17, 2004.

  1. Sam

    Sam Guest

    I have a JTree component in a GUI which displays the state of an
    arbitrary object over time, i.e. as separate entries in the JTree for
    each point in time I want to display. When you click on the object, it
    uses java reflection to display the attributes of the class. What I
    would like to do is "freeze" the object to display the attributes of
    the object *at the time it was added to the JTree component*.
    Otherwise, it will just show the current values for all entries in the
    JTree.

    Copying the object is not practical, since it is actually an object
    tree and would entail some considerable work.

    Is there anyway short of copying the object tree to handle this
    requirement?

    thanks,
    Sam90
     
    Sam, Jun 17, 2004
    #1
    1. Advertising

  2. Sam wrote:
    > What I
    > would like to do is "freeze" the object to display the attributes of
    > the object *at the time it was added to the JTree component*.
    > Otherwise, it will just show the current values for all entries in the
    > JTree.
    >
    > Copying the object is not practical, since it is actually an object
    > tree and would entail some considerable work.


    You are asking for a miracle. Your situation is (t == time):

    t0: Object contains data X
    t1: Object was added to JTree
    t2: Object's data is changed from X to Y. You refuse to store
    the old X, so X is lost.
    t3: You want Object(t1), but that state doesn't exist any more.

    Either you remember the data, or you don't have it. It's that simple.

    /Thomas

    BTW: I hope you add the object to a TreeModel and not just to a JTree.
     
    Thomas Weidenfeller, Jun 18, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. groupie

    Display the jTree

    groupie, Jul 7, 2007, in forum: Java
    Replies:
    3
    Views:
    548
    Mark Space
    Jul 8, 2007
  2. jumpz
    Replies:
    3
    Views:
    628
    Jean-Baptiste Nizet
    Nov 12, 2007
  3. Rasikow Gnaniyar

    Display XML in JTree

    Rasikow Gnaniyar, Mar 12, 2008, in forum: Java
    Replies:
    1
    Views:
    893
    RedGrittyBrick
    Mar 12, 2008
  4. Aaron Fude

    Display an image in a JTree

    Aaron Fude, Nov 27, 2009, in forum: Java
    Replies:
    2
    Views:
    853
    Daniel Pitts
    Nov 28, 2009
  5. Replies:
    5
    Views:
    256
    Olivier Renaud
    Mar 15, 2007
Loading...

Share This Page