Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.client
Class Window

    java.lang.Object
      com.google.gwt.user.client.Window

    public class Window

extends java.lang.Object

This class provides access to the browser window's methods, properties, and events.

Nested Class Summary
`static class` | `Window.ClosingEvent` Fired just before the browser window closes or navigates to a different site.
`static interface` | `Window.ClosingHandler` Handler for `Window.ClosingEvent` events.
`static class` | `Window.Location` This class provides access to the browser's location's object.
`static class` | `Window.Navigator` This class provides access to the browser's navigator object.
`static class` | `Window.ScrollEvent` Fired when the browser window is scrolled.
`static interface` | `Window.ScrollHandler` Handler for `Window.ScrollEvent` events.

Method Summary
`static HandlerRegistration` | `addCloseHandler(CloseHandler<Window> handler)` Adds a `CloseEvent` handler.
`static HandlerRegistration` | `addResizeHandler(ResizeHandler handler)` Adds a `ResizeEvent` handler.
`static void` | `addWindowCloseListener(WindowCloseListener listener)` Deprecated. use `addWindowClosingHandler(ClosingHandler)` and `addCloseHandler(CloseHandler)` instead
`static HandlerRegistration` | `addWindowClosingHandler(Window.ClosingHandler handler)` Adds a `Window.ClosingEvent` handler.
`static void` | `addWindowResizeListener(WindowResizeListener listener)` Deprecated. use `addResizeHandler(ResizeHandler)` instead
`static HandlerRegistration` | `addWindowScrollHandler(Window.ScrollHandler handler)` Adds a `Window.ScrollEvent` handler.
`static void` | `addWindowScrollListener(WindowScrollListener listener)` Deprecated. use `addWindowScrollHandler(ScrollHandler)` instead
`static void` | `alert(java.lang.String msg)` Displays a message in a modal dialog box.
`static boolean` | `confirm(java.lang.String msg)` Displays a message in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons.
`static void` | `enableScrolling(boolean enable)` Use this method to explicitly disable the window's scrollbars.
`static int` | `getClientHeight()` Gets the height of the browser window's client area excluding the scroll bar.
`static int` | `getClientWidth()` Gets the width of the browser window's client area excluding the vertical scroll bar.
`static int` | `getScrollLeft()` Gets the window's scroll left.
`static int` | `getScrollTop()` Get the window's scroll top.
`static java.lang.String` | `getTitle()` Gets the browser window's current title.
`static void` | `open(java.lang.String url, java.lang.String name, java.lang.String features)` Opens a new browser window.
`static void` | `print()` Prints the document in the window, as if the user had issued a "Print" command.
`static java.lang.String` | `prompt(java.lang.String msg, java.lang.String initialValue)` Displays a request for information in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons.
`static void` | `removeWindowCloseListener(WindowCloseListener listener)` Deprecated.
`static void` | `removeWindowResizeListener(WindowResizeListener listener)` Deprecated.
`static void` | `removeWindowScrollListener(WindowScrollListener listener)` Deprecated.
`static void` | `scrollTo(int left, int top)` Scroll the window to the specified position.
`static void` | `setMargin(java.lang.String size)` Sets the size of the margins used within the window's client area.
`static void` | `setStatus(java.lang.String status)` Sets the status text for the window.
`static void` | `setTitle(java.lang.String title)` Sets the browser window's title.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### addCloseHandler

    public static HandlerRegistration addCloseHandler(CloseHandler<Window> handler)

  Adds a `CloseEvent` handler.

  Parameters:
    `handler` - the handler
  Returns:
    returns the handler registration

### addResizeHandler

    public static HandlerRegistration addResizeHandler(ResizeHandler handler)

  Adds a `ResizeEvent` handler.

  Parameters:
    `handler` - the handler
  Returns:
    returns the handler registration

### addWindowCloseListener

    @Deprecated
    public static void addWindowCloseListener(WindowCloseListener listener)

  Deprecated. use `addWindowClosingHandler(ClosingHandler)` and `addCloseHandler(CloseHandler)` instead

  Adds a listener to receive window closing events.

  Parameters:
    `listener` - the listener to be informed when the window is closing

### addWindowClosingHandler

    public static HandlerRegistration addWindowClosingHandler(Window.ClosingHandler handler)

  Adds a `Window.ClosingEvent` handler.

  Parameters:
    `handler` - the handler
  Returns:
    returns the handler registration

### addWindowResizeListener

    @Deprecated
    public static void addWindowResizeListener(WindowResizeListener listener)

  Deprecated. use `addResizeHandler(ResizeHandler)` instead

  Adds a listener to receive window resize events.

  Parameters:
    `listener` - the listener to be informed when the window is resized

### addWindowScrollHandler

    public static HandlerRegistration addWindowScrollHandler(Window.ScrollHandler handler)

  Adds a `Window.ScrollEvent` handler.

  Parameters:
    `handler` - the handler
  Returns:
    returns the handler registration

### addWindowScrollListener

    @Deprecated
    public static void addWindowScrollListener(WindowScrollListener listener)

  Deprecated. use `addWindowScrollHandler(ScrollHandler)` instead

  Adds a listener to receive window scroll events.

  Parameters:
    `listener` - the listener to be informed when the window is scrolled

### alert

    public static void alert(java.lang.String msg)

  Displays a message in a modal dialog box.

  Parameters:
    `msg` - the message to be displayed.

### confirm

    public static boolean confirm(java.lang.String msg)

  Displays a message in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons.

  Parameters:
    `msg` - the message to be displayed.
  Returns:
    `true` if 'OK' is clicked, `false` if 'Cancel' is clicked.

### enableScrolling

    public static void enableScrolling(boolean enable)

  Use this method to explicitly disable the window's scrollbars. Applications that choose to resize their user-interfaces to fit within the window's client area will normally want to disable window scrolling.

  Parameters:
    `enable` - `false` to disable window scrolling

### getClientHeight

    public static int getClientHeight()

  Gets the height of the browser window's client area excluding the scroll bar.

  Returns:
    the window's client height

### getClientWidth

    public static int getClientWidth()

  Gets the width of the browser window's client area excluding the vertical scroll bar.

  Returns:
    the window's client width

### getScrollLeft

    public static int getScrollLeft()

  Gets the window's scroll left.

  Returns:
    window's scroll left

### getScrollTop

    public static int getScrollTop()

  Get the window's scroll top.

  Returns:
    the window's scroll top

### getTitle

    public static java.lang.String getTitle()

  Gets the browser window's current title.

  Returns:
    the window's title.

### open

    public static void open(java.lang.String url,
                            java.lang.String name,
                            java.lang.String features)

  Opens a new browser window. The "name" and "features" arguments are specified here.

  Parameters:
    `url` - the URL that the new window will display
    `name` - the name of the window (e.g. "_blank")
    `features` - the features to be enabled/disabled on this window

### print

    public static void print()

  Prints the document in the window, as if the user had issued a "Print" command.

### prompt

    public static java.lang.String prompt(java.lang.String msg,
                                          java.lang.String initialValue)

  Displays a request for information in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons.

  Parameters:
    `msg` - the message to be displayed
    `initialValue` - the initial value in the dialog's text field
  Returns:
    the value entered by the user if 'OK' was pressed, or `null` if 'Cancel' was pressed

### removeWindowCloseListener

    @Deprecated
    public static void removeWindowCloseListener(WindowCloseListener listener)

  Deprecated.

  Removes a window closing listener.

  Parameters:
    `listener` - the listener to be removed

### removeWindowResizeListener

    @Deprecated
    public static void removeWindowResizeListener(WindowResizeListener listener)

  Deprecated.

  Removes a window resize listener.

  Parameters:
    `listener` - the listener to be removed

### removeWindowScrollListener

    @Deprecated
    public static void removeWindowScrollListener(WindowScrollListener listener)

  Deprecated.

  Removes a window scroll listener.

  Parameters:
    `listener` - the listener to be removed

### scrollTo

    public static void scrollTo(int left,
                                int top)

  Scroll the window to the specified position.

  Parameters:
    `left` - the left scroll position
    `top` - the top scroll position

### setMargin

    public static void setMargin(java.lang.String size)

  Sets the size of the margins used within the window's client area. It is sometimes necessary to do this because some browsers, such as Internet Explorer, add margins by default, which can confound attempts to resize panels to fit exactly within the window.

  Parameters:
    `size` - the window's new margin size, in CSS units.

### setStatus

    public static void setStatus(java.lang.String status)

  Sets the status text for the window. Calling this method in Firefox has no effect.

  Parameters:
    `status` - the new message to display.

### setTitle

    public static void setTitle(java.lang.String title)

  Sets the browser window's title.

  Parameters:
    `title` - the new window title.

Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD