Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JDIC API V2006 Release 0308
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.jdic.browser
Interface IWebBrowser

All Known Implementing Classes:
  WebBrowser

    public interface IWebBrowser

A `IWebBrowser` component represents a blank rectangular area of the screen onto which the application can display webpages or from which the application can trap events from the browser window. In order to show a Browser component in GUI, user need to add Browser to a top-level container, such as `Frame`.

The class that is interested in processing a Browser event should implement interface `WebBrowserListener`, and the object created with that class should use Browser's `addWebBrowserListener` method to register as a listener.

See Also:
  `IBrowserEngine`, `WebBrowserEvent`, `WebBrowserListener`

Method Summary
`void` | `addWebBrowserListener(WebBrowserListener listener)` Adds a `WebBrowserEvent` listener.
`java.awt.Component` | `asComponent()` Returns the component to which the Browser paints.
`void` | `back()` Navigates to the previous session history item.
`void` | `dispatchWebBrowserEvent(WebBrowserEvent event)`
`java.lang.String` | `executeScript(java.lang.String javaScript)` Executes specified JavaScript code in a currently opened document.
`void` | `forward()` Navigates to the next session history item.
`IBrowserEngine` | `getBrowserEngine()` The BrowserEngine that was responsible for creating the browser instance.
`java.lang.String` | `getContent()` Returns the HTML content of a document, opened in a browser.
`java.lang.String` | `getInitFailureMessage()`
`int` | `getInstanceNum()` A IWebBrowser must have a ticket to identify itself, here is the instance num.For a IWebBrowser instance, a native browser instance will be created to deal with its requests, this instance num will be used get according native browser instance.
`int` | `getNativeWindow()` Get the windows' handler of native window
`java.net.URL` | `getURL()` Retrieves the URL that is currently being displayed.
`boolean` | `isBackEnabled()`
`boolean` | `isForwardEnabled()`
`boolean` | `isInitialized()`
`boolean` | `isSynchronize()` If the webbrowser works under synchronize model
`void` | `refresh()` Reloads the URL that is currently being displayed in the WebBrowser component.
`void` | `removeWebBrowserListener(WebBrowserListener listener)` Removes a `WebBrowserEvent` listener.
`void` | `setContent(java.lang.String htmlContent)` Sets new HTML content.
`void` | `setInitFailureMessage(java.lang.String msg)`
`void` | `setInitialized(boolean b)` Set if the IWebBrowser has been initialized.
`void` | `setURL()` Sets the document to be a blank page.
`void` | `setURL(java.net.URL url)` Navigates to a resource identified by an URL using HTTP GET method.
`void` | `setURL(java.net.URL url, java.lang.String postData)` Navigates to a resource identified by an URL using HTTP POST method.
`void` | `setURL(java.net.URL url, java.lang.String postData, java.lang.String headers)` HTTP headers to send to the server.
`void` | `stop()` Stops loading of the current URL.

Method Detail

### addWebBrowserListener

    void addWebBrowserListener(WebBrowserListener listener)

  Adds a `WebBrowserEvent` listener.

  Parameters:
    `listener` - object which implements WebBrowserListener interface.

### removeWebBrowserListener

    void removeWebBrowserListener(WebBrowserListener listener)

  Removes a `WebBrowserEvent` listener.

  Parameters:
    `listener` - object which implements WebBrowserListener interface. If the listener was not in the listeners list, then no listener will be removed.

### isSynchronize

    boolean isSynchronize()

  If the webbrowser works under synchronize model

  Returns:

### asComponent

    java.awt.Component asComponent()

  Returns the component to which the Browser paints. This method is needed to add a Browser to

  Returns:
    The component on which the Browser paints.

### getURL

    java.net.URL getURL()

  Retrieves the URL that is currently being displayed.

  Returns:
    the current URL being display, or `null` if the WebBrowser object is not ready with initialization of itself.

### setURL

    void setURL()

  Sets the document to be a blank page.

### setURL

    void setURL(java.net.URL url)

  Navigates to a resource identified by an URL using HTTP GET method.

  Parameters:
    `url` - the URL to navigate.

### setURL

    void setURL(java.net.URL url,
                java.lang.String postData)

  Navigates to a resource identified by an URL using HTTP POST method.

  Parameters:
    `url` - the URL to navigate.
    `postData` - Data to send to the server during the HTTP POST transaction.

### setURL

    void setURL(java.net.URL url,
                java.lang.String postData,
                java.lang.String headers)

  HTTP headers to send to the server.

  Parameters:
    `url` - the URL to navigate to.
    `postData` - the post data to send with the HTTP POST transaction. For example, `"username=myid&password=mypasswd"`
    `headers` - the HTTP headers to send with the HTTP POST transaction.For ex,`"content-type:text/html\r\ncontent-length:10"`
  Since:
    0.9.2

### getContent

    java.lang.String getContent()

  Returns the HTML content of a document, opened in a browser.

  Returns:
    the HTML content of a document, opened in a browser.

### setContent

    void setContent(java.lang.String htmlContent)

  Sets new HTML content.

  Parameters:
    `htmlContent` - the HTML content to set.

### executeScript

    java.lang.String executeScript(java.lang.String javaScript)

  Executes specified JavaScript code in a currently opened document. This should not be called until after a documentComplete event is fired in `WebBrowserListener`.

  Returns:
    the result of JavaScript execution, if there is any.

### back

    void back()

  Navigates to the previous session history item.

### forward

    void forward()

  Navigates to the next session history item.

### refresh

    void refresh()

  Reloads the URL that is currently being displayed in the WebBrowser component.

### stop

    void stop()

  Stops loading of the current URL.

### getBrowserEngine

    IBrowserEngine getBrowserEngine()

  The BrowserEngine that was responsible for creating the browser instance. Use the BrowserEngine to get information about the Embedded Browser Component that is used for browsing.

  Returns:
    The `BrowserEngine` that was responsible for creating this browser instance.

### isBackEnabled

    boolean isBackEnabled()

### isForwardEnabled

    boolean isForwardEnabled()

### isInitialized

    boolean isInitialized()

### getInstanceNum

    int getInstanceNum()

  A IWebBrowser must have a ticket to identify itself, here is the instance num.For a IWebBrowser instance, a native browser instance will be created to deal with its requests, this instance num will be used get according native browser instance.

  Returns:

### getNativeWindow

    int getNativeWindow()

  Get the windows' handler of native window

  Returns:

### dispatchWebBrowserEvent

    void dispatchWebBrowserEvent(WebBrowserEvent event)

  Parameters:
    `event` -

### setInitFailureMessage

    void setInitFailureMessage(java.lang.String msg)

### getInitFailureMessage

    java.lang.String getInitFailureMessage()

### setInitialized

    void setInitialized(boolean b)

  Set if the IWebBrowser has been initialized.

  Parameters:
    `b` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JDIC API V2006 Release 0308
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

For more information and documentation on JDIC, see JDIC website.

That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, working code examples, license terms and bug report information.

Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.