Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

close frames

 
aude tantot
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • 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
 
Sanjay Bahrani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
thanks
another way i found is to call the setClosed() method which throw java.beans.PropertyVetoException
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!