blob: 80e0f2a38e8fbf46ee43887f3b8b3a0ea30033ca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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
}
//==============================================================================
|