Class Frame

All Implemented Interfaces:
HasLoadHandlers, HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget
Direct Known Subclasses:
NamedFrame

public class Frame extends Widget implements HasLoadHandlers
A widget that wraps an IFRAME element, which can contain an arbitrary web site.

Note that if you are using History, any browser history items generated by the Frame will interleave with your application's history.

CSS Style Rules

  • .gwt-Frame { }

Example

public class FrameExample implements EntryPoint {

  public void onModuleLoad() {
    // Make a new frame, and point it at Google.
    Frame frame = new Frame("http://www.google.com/");

    // Add it to the root panel.
    RootPanel.get().add(frame);
  }
}

  • Field Details

  • Constructor Details

    • Frame

      public Frame()
      Creates an empty frame.
    • Frame

      public Frame(String url)
      Creates a frame that displays the resource at the specified URL.
      Parameters:
      url - the URL of the resource to be displayed
    • Frame

      protected Frame(Element element)
      This constructor may be used by subclasses to explicitly use an existing element. This element must be an <iframe> element.
      Parameters:
      element - the element to be used
  • Method Details

    • wrap

      public static Frame wrap(Element element)
      Creates a Frame widget that wraps an existing <frame> element. This element must already be attached to the document. If the element is removed from the document, you must call Widget.removeFromParent().
      Parameters:
      element - the element to be wrapped
    • addLoadHandler

      public HandlerRegistration addLoadHandler(LoadHandler handler)
      Adds a LoadEvent load handler which will be called when the frame loads.
      Specified by:
      addLoadHandler in interface HasLoadHandlers
      Parameters:
      handler - the load handler
      Returns:
      HandlerRegistration that can be used to remove this handler
    • getUrl

      public String getUrl()
      Gets the URL of the frame's resource.
      Returns:
      the frame's URL
    • setUrl

      public void setUrl(String url)
      Sets the URL of the resource to be displayed within the frame.
      Parameters:
      url - the frame's new URL
    • setUrl

      public void setUrl(SafeUri url)
      Sets the URL of the resource to be displayed within the frame.
      Parameters:
      url - the frame's new URL