# Class BrowserWindow

java.lang.Object
com.codename1.ui.BrowserWindow

public class BrowserWindow extends Object
Encapsulates a WebView that is contained in its own separate window when run on a Desktop (e.g. Simulator). Platforms that don't have "windows", will fall back to loading a Form with a BrowserComponent in it.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `BrowserWindow.EvalRequest`
  A future that is returned from the eval() method.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BrowserWindow(String startURL)`
  Creates a new browser window with the given starting URL.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addCloseListener(ActionListener l)`
  Adds listener to be notified when the browser window is closed.
  `void`
  `addLoadListener(ActionListener l)`
  Adds listeners to be notified when a page is loaded in the browser window.
  `void`
  `close()`
  Closes the browser window.
  `void`
  `removeCloseListener(ActionListener l)`
  Removes listener from being notified when the browser window is closed.
  `void`
  `removeLoadListener(ActionListener l)`
  Removes listeners from being notified when page is loaded in the browser window.
  `void`
  `setSize(int width, int height)`
  Sets the size in pixels of the browser window.
  `void`
  `setTitle(String title)`
  Sets the window title for the browser window.
  `void`
  `show()`
  Shows the browser window.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BrowserWindow

    public BrowserWindow(String startURL)

    Creates a new browser window with the given starting URL.

    ###### Parameters

    - `startURL`: The URL to start with.

- ## Method Details

  - ### addLoadListener

    public void addLoadListener(ActionListener l)

    Adds listeners to be notified when a page is loaded in the browser window. ActionEvents will have the URL of the page as a string as its "source" property.

    ###### Parameters

    - `l`: Listener to add.

  - ### removeLoadListener

    public void removeLoadListener(ActionListener l)

    Removes listeners from being notified when page is loaded in the browser window.

    ###### Parameters

    - `l`

  - ### setTitle

    public void setTitle(String title)

    Sets the window title for the browser window.

    ###### Parameters

    - `title`: The title for the window.

  - ### setSize

    public void setSize(int width, int height)

    Sets the size in pixels of the browser window.

    ###### Parameters

    - `width`: The width in pixels

    - `height`: The height in pixels

  - ### close

    public void close()
    Closes the browser window.

  - ### addCloseListener

    public void addCloseListener(ActionListener l)

    Adds listener to be notified when the browser window is closed.

    ###### Parameters

    - `l`

  - ### removeCloseListener

    public void removeCloseListener(ActionListener l)

    Removes listener from being notified when the browser window is closed.

    ###### Parameters

    - `l`

  - ### show

    public void show()
    Shows the browser window.