-
- /**
- * Get parent JOptionPane if there is one
- */
- public static Container getAncestorClass(Object o, Class cl)
- {
- Container c;
- if (o instanceof Container)
- c = (Container) o;
- else
- return null;
- Container p = c.getParent();
- if (p == null)
- return null;
- if (p.getClass() == cl)
- {
- return p;
- }
- else if (p instanceof Component)
- {
- return getAncestorClass((Component) p, cl);
- }
- return null;
- }