1 /***
2 *
3 */
4 package org.telscenter.pas.ui.util;
5
6 import java.awt.Component;
7 import java.awt.Container;
8
9 /***
10 * @author anthonyperritano
11 *
12 */
13 public class ComponentUtil {
14
15 public static Component findComponent(Component comp, Class<? extends Component> c) {
16
17 if (c.isAssignableFrom(comp.getClass())) {
18 return comp;
19 }
20 if (comp instanceof Container) {
21 Component[] comps = ((Container) comp).getComponents();
22 for (int i = 0; i < comps.length; i++) {
23 Component tmp = findComponent(comps[i], c);
24 if (tmp != null) {
25 return tmp;
26 }
27 }
28 }
29 return null;
30 }
31 }