1319 |
&& b.x >= a.x && b.x + b.width <= a.x + a.width && b.y >= a.y |
&& b.x >= a.x && b.x + b.width <= a.x + a.width && b.y >= a.y |
1320 |
&& b.y + b.height <= a.y + a.height; |
&& b.y + b.height <= a.y + a.height; |
1321 |
} |
} |
1322 |
|
|
1323 |
|
/** |
1324 |
|
* Returns the InputMap that is provided by the ComponentUI of |
1325 |
|
* <code>component</code> for the specified condition. |
1326 |
|
* |
1327 |
|
* @param component the component for which the InputMap is returned |
1328 |
|
* @param cond the condition that specifies which of the three input |
1329 |
|
* maps should be returned, may be |
1330 |
|
* {@link JComponent#WHEN_IN_FOCUSED_WINDOW}, |
1331 |
|
* {@link JComponent#WHEN_FOCUSED} or |
1332 |
|
* {@link JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT |
1333 |
|
* |
1334 |
|
* @return |
1335 |
|
*/ |
1336 |
|
public static InputMap getUIInputMap(JComponent component, int cond) |
1337 |
|
{ |
1338 |
|
if (UIManager.getUI(component) != null) |
1339 |
|
// we assume here that the UI class sets the parent of the component's |
1340 |
|
// InputMap, which is the correct behaviour. If it's not, then |
1341 |
|
// this can be considered a bug |
1342 |
|
return component.getInputMap(cond).getParent(); |
1343 |
|
else |
1344 |
|
return null; |
1345 |
|
} |
1346 |
|
|
1347 |
|
/** |
1348 |
|
* Returns the ActionMap that is provided by the ComponentUI of |
1349 |
|
* <code>component</code>. |
1350 |
|
* |
1351 |
|
* @param component the component for which the ActionMap is returned |
1352 |
|
*/ |
1353 |
|
public static ActionMap getUIActionMap(JComponent component) |
1354 |
|
{ |
1355 |
|
if (UIManager.getUI(component) != null) |
1356 |
|
// we assume here that the UI class sets the parent of the component's |
1357 |
|
// ActionMap, which is the correct behaviour. If it's not, then |
1358 |
|
// this can be considered a bug |
1359 |
|
return component.getActionMap().getParent(); |
1360 |
|
else |
1361 |
|
return null; |
1362 |
|
} |
1363 |
} |
} |