code_junkie

How to tell if my Java component is in an Applet

Nov 13th, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. boolean isInAnApplet(Component c)
  2. {
  3. Component p = c.getParent();
  4. if (p != null) {
  5. return isInAnApplet(p);
  6. } else {
  7. return (c instanceof Applet);
  8. }
  9. }
Add Comment
Please, Sign In to add comment