Let me be a little more specific.
My subquestion is:
When I wrote this:
MyClass = new MyClass();
does all variables are initialize like I first
create it.
> My small application (JTree, JTable & JPanel) draws
> data from database and everyting works just fine.
[quoted text clipped - 18 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.725 / Virus Database: 480 - Release Date: 20.7.2004
Andrew Thompson - 17 Sep 2004 14:53 GMT
> When I wrote this:
> MyClass = new MyClass();
> does all variables are initialize like I first
> create it.
So find out. Create an object of the class,
use the setXXX method on something that is
initialized, create a second instance and
print them both.
For extra marks, declare an attribute of the
class as 'static' and repeat the experiment,
note and comment on any differences.

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Babu Kalakrishnan - 17 Sep 2004 14:53 GMT
[Moving top posted second message down]
>>My small application (JTree, JTable & JPanel) draws
>>data from database and everyting works just fine.
[quoted text clipped - 11 lines]
>
>>to null and initialize again?
> Let me be a little more specific.
> My subquestion is:
> When I wrote this:
> MyClass = new MyClass();
> does all variables are initialize like I first
> create it.
Speaking from the Java point of view, all *instance* variables of the
class MyClass will get initialized to their default values - but if you
used any static variables and modified their values earlier, they will
not be initialized again - they will retain their values.
But I suspect your question is slightly different and you want to know
if the Frame (or Dialog) that MyClass represents would suddenly change
its appearance to show its new state as soon as you set the variable
"MyApp" to point to a newly created instance ? If so the answer is no.
You would need to dispose off the old Frame and call show() on the new
instance for it to reappear.
BK
Dado - 21 Sep 2004 09:53 GMT
> [Moving top posted second message down]
> >
[quoted text clipped - 34 lines]
>
> BK
OK. I think that dispose() works with JFrame, but how to "dispose" JPanel?
I saw that memory usage grows when
I wrote:
panel.removeAll();
panel = null;
panel = new JPanel();
...
Babu Kalakrishnan - 21 Sep 2004 10:11 GMT
> OK. I think that dispose() works with JFrame, but how to "dispose" JPanel?
>
[quoted text clipped - 4 lines]
> panel = new JPanel();
> ...
A JPanel doesn't need anything special to be done to it for it to be
Garbage collected. Just like any other Java object, you need to only
ensure that no reference to it exists from any other live java object in
your application to ensure that it is /eligible for/ garbage collection.
(In this particular case, you can check if panel.getParent() is null
just before you set it to null. If it is non-null, the parent would be
holding a reference to it in its "children" list)
BK
Dado - 22 Sep 2004 09:31 GMT
> > OK. I think that dispose() works with JFrame, but how to "dispose" JPanel?
> >
[quoted text clipped - 15 lines]
>
> BK
Thank you, some thing are now clear.