Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dispose windows

 
ravikumar Chilukuri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

how dispose the childrens of a frame wich were not displayed(i.e. not showing on the screen)...

for this wrote the code as following....



But windows are not getting disposed...
can any one suggest me a way to achieve this....

Thanks in advance....
Ravi
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But windows are not getting disposed...

How did you test that?

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

edit Never compare a boolean to true or false, it's redundant.Always assuming that's what needs to be tested.

edit2 If your purpose is to purge the previously opened but no longer reachable Frames so that they are not returned in the array from Frame.getFrames(), call System.gc();. That this does in fact run the GC on all Sun JVMs is an implementation detail, so it shouldn't be relied on.

What is your exact requirement?
 
ravikumar Chilukuri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Darryl,

thankyou very much for reply and code correction..

my exact requirement was that what you expected..

i want to purge the previously opened but no longer reachable Frames..


in our application i'm adding a glassPane to the top most window which shows a progressbar when the server hit was done..

for that i'm getting the child windows using frame.getOwnedWindows(), and checking which one was focused..

so every time frame.getOwnedWindows() was returning all the windows including no longer reachable windows...

thats the reason i want to purge no longer reachable windows.
 
Rob Camick
Ranch Hand
Posts: 2613
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for that i'm getting the child windows using frame.getOwnedWindows(), and checking which one was focused..


You should be able to use the following to get that information:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic