🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TreeModel

#1427
From: Tad Frysinger [TeamB]
Date: Wed, 12 Nov 2003 02:21
27 lines
1988 bytes
Ruben Misrahi wrote:

> I have a JTree that is associated with a TreeModel.
> The TreeModel uses a TableDataSet to implement its methods:
> 
> At some point I modify the TableDataSet and I was expecting the JTree to be
> modified as well, but this doesn't happen unless I call:
>     jTree1.setModel(null);
>     jTree1.setModel(tm); // tm is my implementation to TreeModel
> 
> Other than this, things work as expected.
> Does anyone know why do I have to de-assign and then re-assign again my
> JTree to a model? I would think that the great advantage of the model
> approach was precisely that.
> (JBuilder7).
> 
> Thanks
> 
> 
Because if you change the data that underlies the model without 
notifying the model, then the JTree has no idea what has happened. There 
are various notifications that you can do here. I can point you to the 
online JTree and DefaultTreeModel tutorial sections, or the excellent 
(even if somewhat dated) Geary book on Swing.

-- 
Tad Frysinger [TeamB]
Technical Details
Message-ID: <3fb19955$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3faf8427@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,d6e73e2a3a1e06e4
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-11-11 18:39:38 PST
Date: Tue, 11 Nov 2003 19:21:40 -0700
From: "Tad Frysinger [TeamB]" <tfrysinger@earthlink.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: TreeModel
References: <3faf8427@newsgroups.borland.com>
In-Reply-To: <3faf8427@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.165.213.196
Message-ID: <3fb19955$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1068603733 67.165.213.196 (11 Nov 2003 18:22:13 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail