if (clazz != null && clazz.isAssignableFrom(c.getClass())) {
//so far so good, recurse
return matches(c.getParent(), partIndex - 1);
} else if (clazz == null &&
registeredRegions.containsKey(parts[partIndex].s)) {
Region r = registeredRegions.get(parts[partIndex].s);
Component parent = r.isSubregion() ? c : c.getParent();
//special case the JInternalFrameTitlePane, because it
//doesn't fit the mold. very, very funky.
if (r == Region.INTERNAL_FRAME_TITLE_PANE && parent != null
&& parent instanceof JInternalFrame.JDesktopIcon) {
JInternalFrame.JDesktopIcon icon =