47 |
import java.awt.Frame; |
import java.awt.Frame; |
48 |
import java.awt.Graphics; |
import java.awt.Graphics; |
49 |
import java.awt.Insets; |
import java.awt.Insets; |
50 |
|
import java.awt.KeyboardFocusManager; |
51 |
import java.awt.Point; |
import java.awt.Point; |
52 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
53 |
import java.awt.Shape; |
import java.awt.Shape; |
130 |
} |
} |
131 |
|
|
132 |
/** |
/** |
133 |
|
* Returns the focus owner or <code>null</code> if <code>comp</code> is not |
134 |
|
* the focus owner or a parent of it. |
135 |
|
* |
136 |
|
* @param comp the focus owner or a parent of it |
137 |
|
* |
138 |
|
* @return the focus owner, or <code>null</code> |
139 |
|
* |
140 |
|
* @deprecated 1.4 Replaced by |
141 |
|
* <code>KeyboardFocusManager.getFocusOwner()</code>. |
142 |
|
*/ |
143 |
|
public static Component findFocusOwner(Component comp) |
144 |
|
{ |
145 |
|
// Get real focus owner. |
146 |
|
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager() |
147 |
|
.getFocusOwner(); |
148 |
|
|
149 |
|
// Check if comp is the focus owner or a parent of it. |
150 |
|
Component tmp = focusOwner; |
151 |
|
|
152 |
|
while (tmp != null) |
153 |
|
{ |
154 |
|
if (tmp == comp) |
155 |
|
return focusOwner; |
156 |
|
|
157 |
|
tmp = tmp.getParent(); |
158 |
|
} |
159 |
|
|
160 |
|
return null; |
161 |
|
} |
162 |
|
|
163 |
|
/** |
164 |
* Calculates the bounds of a component in the component's own coordinate |
* Calculates the bounds of a component in the component's own coordinate |
165 |
* space. The result has the same height and width as the component's |
* space. The result has the same height and width as the component's |
166 |
* bounds, but its location is set to (0,0). |
* bounds, but its location is set to (0,0). |