aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to close jInternal Frame as soon as focus  moves to any object in the parent JFrame. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to close jInternal Frame as soon as focus  moves to any object in the parent JFrame." Watch "How to close jInternal Frame as soon as focus  moves to any object in the parent JFrame." New topic
Author

How to close jInternal Frame as soon as focus moves to any object in the parent JFrame.

Pratham Jain
Greenhorn

Joined: Jun 20, 2013
Posts: 3
I have a form (JFrame). When I click a button in this frame a new sub form (jInternalFrame) opens.
I need help in understanding how to close the jInternalFrame as soon as it or any of the components from it looses focus.

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2419
    
    7

Welcome to the Ranch.

Your answer lies in the Event Listeners section of the Swing tutorial. Which event listener is the appropriate one depends on how you define "focus": keyboard, mouse, jinternalframe or something else.

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Please BeForthrightWhenCrossPostingToOtherSites (link).


The quieter you are, the more you are able to hear.
 
jQuery in Action, 2nd edition
 
subject: How to close jInternal Frame as soon as focus moves to any object in the parent JFrame.