summaryrefslogblamecommitdiffstats
path: root/modules/hebrew-wlc/WLC2OSIS/Utilities/GetParentFrame.java
blob: 80e0f2a38e8fbf46ee43887f3b8b3a0ea30033ca (plain) (tree)

































                                                                                 
package Utilities ;

import java.awt.*;
import javax.swing.*;
//==============================================================================
/**
 * <b>Gets ultimate parent Frame of a component.</b><p>
 *
 *    From page 274 of Pure JFC Swing.<p>
 *
 */
//==============================================================================

public class GetParentFrame{

//-------------------------------------------------------------------------------
/**
 * Gets the ultimate parent Frame of a Component.<p> 
 *
 * @param comp a Component whose parent is sought.
 * @return a Frame Ultimate parent Frame of component.
 */
static public Frame GetParentFrame(Component comp){
    if (comp instanceof Frame) return (JFrame)comp ;
    for (Component c = comp; c!= null; c = c.getParent() ){
        if (c instanceof Frame){ 
            return (Frame)c ;
            }
        }
    return null ;
    }
//  end of class
}
//==============================================================================