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 
    A future that is returned from the eval() method.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new browser window with the given starting URL.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds listener to be notified when the browser window is closed.
    void
    Adds listeners to be notified when a page is loaded in the browser window.
    void
    Closes the browser window.
    void
    Removes listener from being notified when the browser window is closed.
    void
    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
    Sets the window title for the browser window.
    void
    Shows the browser window.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • 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.