code: public static Frame getFrame(Component component)
      {
          while (component != null)
          {
              if (component instanceof Frame)
                  return (Frame)component;
              component = component.getParent();
          }
          return null;
      }
docs: Get the frame for this component.
  @param component The component to get the frame for.
  @return The frame (or null).