• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFrame and Internal Frame

 
Saidur Rahman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,

I am trying to develop a window that has an internal frame. When the internal frame is visible, I want the user will not be able to close the main frame or window unless the internal frame is closed.
How can i do this???

Thank you all.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) call setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE).
2) add a WindowListener that will do the closing for you. Most important method to implement is windowClosing. You can override WindowAdapter so you only need to implement that one method.
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you want to use a JInternalFrame? The problem description looks like what you really want is a modal JDialog.

db
 
Saidur Rahman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks db... I was exactly looking for a dialog.

-----------------------
Saidur
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!