• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

close frames

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got some internal frames that appear in a main frame and i would like to be able to close them with code lines. I haven't found a method doing that in the frame API, so I ask some help
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Normally you can destroy a frame by using the window listener and you want to destroy the internal frames,wright? If yes, add the windowListener to all the internal frames and you can destroy the frames by clicking on the x button of frame.
the below code is for destroying the frame.....

import java.awt.*;
public class TestFrame{
Test(){
// Add your necessary frame components
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
}
}
 
aude tantot
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks
another way i found is to call the setClosed() method which throw java.beans.PropertyVetoException
 
reply
    Bookmark Topic Watch Topic
  • New Topic