Dear friends,
Thanks in advance.....

I'm working on project which includes multiple frames.
whenever I need to open other frame with first one get closed , I have used new instance of new class(frame) and I just make setVisible(false) for previous frame.
Now after some use , there is problem of heap memory full.

Tell me what should I do to free the current frame object instead of setVisible(false)?

waiting for reply.......


I have used the code like below,

new MainWindow().setVisible(true);
 setVisible(false);

dispose()

after hiding.

setVisisble(false) simply "hides" it, it does not "get rid of it".

and every time creating a new instance means after a while you'll have x instances of one object open, while you can only use 1

Thanks All of you.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.