public interface IBrowserCanvas
IBrowserCanvas
provides native browsing facilities inside a
standard javax.swing.JPanel
. This interface provides a platform and
browser independent mechanism to access these native resources.
Some extra browser-specific functionality can be accessed via other supplied
interfaces. For example, Mozilla browsers can access the
IMozillaBrowserCanavas
interface which allows the user to save a
HTML page to a local drive.
IMozillaBrowserCanvas
Modifier and Type | Field and Description |
---|---|
static int |
KEY_CODE_BACKSPACE |
static int |
KEY_CODE_DELETE |
static int |
KEY_CODE_TAB |
static int |
KEY_MODIFIER_CTRL_DOWN |
static int |
KEY_MODIFIER_SHIFT_DOWN |
static int |
PRINT_DEFAULT_ACTION
This flag is for the machines default printing behavior
|
static int |
PRINT_ORIENTATION_LANDSCAPE |
static int |
PRINT_ORIENTATION_PORTRAIT |
static int |
PRINT_SHOW_DIALOG_BOX
This flag is for showing the default Print dialog
|
static int |
PRINT_SILENT
This flag is to prevent dialogs from showing when printing
|
static int |
RELOAD_BYPASS_CACHE
This flag indicates to
reload() that it should skip the
cache, but still use the proxy. |
static int |
RELOAD_BYPASS_PROXY
This flag indicates to
reload() that it should use the
cache, but skip the proxy. |
static int |
RELOAD_BYPASS_PROXY_AND_CACHE
This flag indicates to
reload() that it should skip the
cache and proxy. |
static int |
RELOAD_NORMAL
This flag indicates to
reload() that it should use
the cache and proxy. |
Modifier and Type | Method and Description |
---|---|
void |
addAppletListener(AppletListener listener)
Add an
AppletListener that will receive events when an applet
is created in this browser. |
void |
addBlockedURL(String strURL)
Adds URL to the list of blocked URLs (URLs that are not displayed).
|
void |
addBrowserListener(BrowserListener listener)
Adds the specified browser listener that will receive browser events from this
component.
|
void |
addJavascriptListener(JavascriptListener listener)
Adds the specified JavaScript listener that will receive JavaScript events from
this component.
|
void |
addKeyListener(KeyListener listener)
Adds the specified Key listener that will receive network events from
this component.
|
void |
addMouseListener(MouseListener listener)
Adds the specified Mouse listener that will receive mouse events from
this component.
|
void |
addNetworkListener(NetworkListener listener)
Adds the specified network listener that will receive network events from
this component.
|
void |
addPromptListener(PromptListener listener)
Adds a PromptListener.
|
void |
addWindowListener(WindowListener listener)
Adds the specified window listener that will receive new Window events from this component.
|
void |
allowPopups(boolean bOnOff)
Sets if this Browser Canvas can spawn popups
|
void |
autoconfigureProxy(String url)
Indicate a URL which automatically configures the proxy settings for all
the protocols.
|
boolean |
canGoBack()
Indicates whether the browser can navigate backwards in history.
|
boolean |
canGoForward()
Indicates whether the browser can navigate forwards in history.
|
boolean |
canRedo()
Return true if there is a change that can be redone with the redo command on the current
focused element.
|
boolean |
canUndo()
Return true if there is a change that can be undone with the undo command on the current
focused element.
|
void |
copy()
Copies the selected text to the Clipboard
This can then be accessed by other applications by using the Paste Command (Ctrl+V)
|
void |
cut()
Cuts the selected text, removing the selection and adding it to the Clipboard
This can then be accessed by other applications by using the Paste Command (Ctrl+V)
This command can only be used when
setHTMLEditingMode(true) has been
called on the IBrowserCanvas |
void |
decreaseTextZoom()
Decreases the size of text on the page.
|
void |
deleteCookies()
Deletes stored cookies.
|
void |
disableCache()
Disables the cache.
|
void |
disableCookies()
Disable cookies feature.
|
void |
disableHTTPSDialog(boolean onOff)
Enables or disables display of security warning dialogs.
|
void |
disableProxy()
Disable the current proxy settings
|
void |
dispatchClickEventToPoint(int x,
int y)
Fires a click event at given coordinates from top left corner of the IBrowserCanvas.
|
void |
enableCache()
Enables the cache.
|
void |
enableCookies()
Enables cookies feature.
|
void |
enableDefaultContextMenu(boolean onOff)
Sets whether to show the default right click menu
|
void |
enableImageLoading(boolean enable)
Allow images to load.
|
void |
enablePlugins(boolean toEnable)
Enable or disable plugins on this browser.
|
void |
enableProxy()
Enables the current proxy settings
|
void |
executeScript(String javascriptBody)
Executes the specified script on the currently loaded document.
|
String |
executeScriptWithReturn(String javascriptBody)
Executes the specified script on the currently loaded document.
|
boolean |
getAllowPopups()
Gets if this Browser Canvas can spawn popups
|
boolean |
getBoolPrefProperty(String propName)
Gets the boolean value of a property.
|
String |
getBrowserType()
Returns a string indicating the underlying browser.
|
String |
getCompanyName()
Gets the name of the company.
|
Component |
getComponent()
Casts the
IBrowserCanvas down to a Component
This is useful for adding the IBrowserCanvas to Containers |
String |
getCookie()
Gets the cookie for the currently loaded domain.
|
String |
getCookie(String URL)
Gets the specified cookie.
|
boolean |
getDefaultContextMenuStatus()
Gets whether the Default context menu is enabled for right mouse clicks.
|
boolean |
getdisableHTTPSDialog()
Gets status of security warning dialog display setting.
|
IDocument |
getDocument()
This gives access to the DOM of the loaded document.
|
IHistory |
getHistory()
Gets the browser history.
|
boolean |
getHTMLEditingMode()
Gets whether the current webpage is in editing mode.
|
boolean |
getHTTPHeadersEnabled()
Returns whether or not HTTP headers will be intercepted for
inspection/modification.
|
int |
getIntPrefProperty(String propName)
Gets the integer value of a property.
|
boolean |
getJavascriptEnabled()
Gets the status of JavaScript.
|
IOptionsService |
getOptionsService()
Returns an
IOptionsService object that can be used to manipulate
various browser options and preferences. |
IPluginService |
getPluginService()
Returns an
IPluginService object that can be used to configure
plugin support and plugin options. |
boolean |
getPopupParentWindow()
Gets whether popups will be opened in a new window or the current
IBrowserCanvas
Default is false |
int |
getPrinterMarginBottom()
Get the current bottom printerMargin value.
|
int |
getPrinterMarginLeft()
Get the current left printerMargin value.
|
int |
getPrinterMarginRight()
Get the current right printerMargin value.
|
int |
getPrinterMarginTop()
Get the current top printerMargin value.
|
PrintRequestAttributeSet |
getPrintRequestAttributeSet()
Get the current
PrintRequestAttributeSet on the browser. |
String |
getProductName()
Gets the name of the product.
|
String |
getProxyBypasses()
Gets a string containing the domain names which bypass the given proxy settings.
|
ProxySetting |
getProxyProtocol(int protocol)
Retrieves the proxy settings for the given protocol.
|
String |
getSelectedText()
Gets the active text selection in the browser.
|
String |
getStringPrefProperty(String propName)
Gets the String value of a property.
|
String |
getTitle()
Get the title of the current resource being displayed.
|
String |
getURL()
Get the URL of the current resource being displayed.
|
String |
getVersion()
Get the version of the product as a string.
|
Node |
getW3CDocument() |
String |
getWebRendererVersion()
Get a version identification string for components of WebRenderer
|
IZoomService |
getZoomService()
Returns an
IZoomService object that can be used to manipulate
the browser's full-page-zoom functionality. |
void |
goBack()
Move backwards through resource history.
|
void |
goForward()
Move forward through resource history.
|
void |
highlightSelectedText(Color color)
Changes the background color on the current selection to given color.
|
void |
httpPOST(String strURL,
File file,
String fileVariableName)
Load URL with File which should be uploaded
|
void |
httpPOST(String strURL,
File file,
String fileVariableName,
String additionalPOSTData)
Load URL with POST String Data and File which should be uploaded
Format of additionalPOSTData parameter:
name=Parameter_name\r\n\r\nParamter_value\r\n
where Paramter_name is a form field name and Paramter_value is form field value
|
void |
httpPOST(String strURL,
String POSTData)
Load URL with POST String Data.
|
void |
increaseTextZoom()
Increases the size of text on the page.
|
void |
insertHTML(String strHTMLText)
Insert some HTML source at the current location (active element).
|
boolean |
isCacheDisabled()
Gets the disabled status of the cache.
|
boolean |
isCookiesEnabled()
Gets the on/off status of the cookies feature
|
boolean |
isPluginsEnabled()
Returns if plugins are enabled.
|
boolean |
isProxyEnabled()
Gets the on/off status of the proxy settings
|
boolean |
isScrollBarsVisible()
Returns flag that indicates if the scrollbars are visible or not
|
void |
loadHTML(byte[] HTML,
String relativePath)
Renders the content of a byte array on the
IBrowserCanvas |
void |
loadHTML(InputStream HTMLStream,
String relativePath)
Renders's the content of an Input Stream on the
IBrowserCanvas |
void |
loadHTML(String html,
String relativePath)
Renders the content of a string on the
IBrowserCanvas |
void |
loadURL(int NavConstants,
String strURL,
byte[] POSTData,
String TargetFrameName,
String Headers)
Load URL with POST Byte Data, Headers data and TargetFrameName
|
void |
loadURL(String url)
Loads the resource at the given URL in the browser window.
|
void |
loadURL(URL url)
Loads the resource at the given URL in the browser window.
|
String |
makeImageUrl(BufferedImage img)
Registers this image in wrimage:// protocol.
|
void |
paste()
Pastes the text from the clipboard to the current document
This command can only be used when
setHTMLEditingMode(true) has been
called on the IBrowserCanvas |
void |
print(int Options)
Print Document with options.
|
void |
print(int Options,
PrinterJob printerJob)
Print Document with options using given PrinterJob.
|
int |
printPreview()
Displays in the
IBrowserCanvas a print preview of the current page. |
IBrowserCanvas |
printPreviewInNewWindow(boolean show)
This creates a new
IBrowserCanvas , in which the current
page is loaded. |
void |
redo()
Redo the last command if the current focused element is a TextArea or Input text element.
|
void |
reload(int flags)
Reload the current resource.
|
void |
removeAppletListener(AppletListener listener)
Removes the specified
AppletListener from this browser, so that
it will no longer receive applet events. |
void |
removeBlockedURL(String strURL)
Removes a URL from the list of blocked URLs.
|
void |
removeBrowserListener(BrowserListener listener)
Removes the specified browser listener so that it no longer receives
browser events from this component.
|
void |
removeJavascriptListener(JavascriptListener listener)
Removes the specified JavaScript listener so that it no longer receives
JavaScript events from this component.
|
void |
removeKeyListener(KeyListener listener)
Removes the specified Keyboard listener so that it no longer receives
browser events from this component.
|
void |
removeMouseListener(MouseListener listener)
Removes the specified Mouse listener so that it no longer receives
browser events from this component.
|
void |
removeNetworkListener(NetworkListener listener)
Removes the specified network listener so that it no longer receives
network events from this component.
|
void |
removePromptListener(PromptListener listener)
Removes the specified Prompt listener so that it no longer receives
browser events from this component.
|
void |
removeWindowListener(WindowListener listener)
Removes a WindowListener.
|
int |
savePageToBitmapImage(String strLocalFileName,
boolean full)
Save contents of HTML page to an image of type PNG.
|
BufferedImage |
saveToBufferedImage(boolean bWholePage,
boolean bKeepAlpha)
Saves the current page to a buffered image.
|
void |
saveToFile(String filename)
Saves the currently loaded webpage to disk.
|
void |
selectAll()
Selects all text on the
IBrowserCanvas |
void |
sendKeyPressToElement(int keyCode,
int modifiers)
Sends a key event to the currently focused element with the given key code and character code.
|
void |
setCookie(String Value)
Sets the cookie for the currently loaded domain.
|
void |
setCookie(String URL,
String Value)
Sets cookie for a given domain.
|
void |
setHTMLEditingMode(boolean onOff)
Sets whether the page is in editing mode or not
When a page is in editing mode, text can be dragged, and contents can be cut.
|
void |
setHTTPHeadersEnabled(boolean enable)
Set whether HTTP Headers will be intercepted for inspection/modification.
|
void |
setJavascriptEnabled(boolean bOnOff)
Turns JavaScript on/off.
This method can be called at any time with the effects happening on the next page load. |
void |
setPopupParentWindow(boolean bOnOff)
Navigate in the same window without popup windows creation.
|
void |
setPreferredSize(int width,
int height)
Sets the preferred size of WebRenderer.
|
void |
setPrefProperty(String pref,
boolean onOff)
Sets an optional property of the underlying browser.
|
void |
setPrefProperty(String pref,
int intPref)
Sets an optional property of the underlying browser.
|
void |
setPrefProperty(String pref,
String stringPref)
Sets an optional property of the underlying browser.
|
void |
setPrintBackground(boolean onOff)
Set whether to print background images and colors.
|
void |
setPrinterMargin(int aMarginTop,
int aMarginBottom,
int aMarginLeft,
int aMarginRight)
Set the default printerMargin to use when printing.
|
void |
setPrintRequestAttributeSet(PrintRequestAttributeSet attributes)
Set
PrintRequestAttributeSet object for following print calls
on this browser. |
void |
setProxyBypasses(String urls)
Sets the domain names and URLs which bypass the proxy settings.
|
void |
setProxyProtocol(ProxySetting proxy)
Sets the proxy settings.
|
void |
showScrollBars(boolean bShow)
Shows/Hides scrollbars
|
void |
stopLoad()
Stop the browser from loading a resource.
|
void |
undo()
Undo the last command if the current focused element is a TextArea or Input text element.
|
static final int PRINT_ORIENTATION_PORTRAIT
static final int PRINT_ORIENTATION_LANDSCAPE
static final int KEY_MODIFIER_SHIFT_DOWN
static final int KEY_MODIFIER_CTRL_DOWN
static final int KEY_CODE_BACKSPACE
static final int KEY_CODE_TAB
static final int KEY_CODE_DELETE
static final int RELOAD_NORMAL
reload()
that it should use
the cache and proxy.reload(int)
,
Constant Field Valuesstatic final int RELOAD_BYPASS_CACHE
reload()
that it should skip the
cache, but still use the proxy.reload(int)
,
Constant Field Valuesstatic final int RELOAD_BYPASS_PROXY
reload()
that it should use the
cache, but skip the proxy.reload(int)
,
Constant Field Valuesstatic final int RELOAD_BYPASS_PROXY_AND_CACHE
reload()
that it should skip the
cache and proxy.reload(int)
,
Constant Field Valuesstatic final int PRINT_DEFAULT_ACTION
static final int PRINT_SHOW_DIALOG_BOX
static final int PRINT_SILENT
String getBrowserType()
MOZILLA
to indicate a Mozilla-based browser.
These values can be used to cast a IBrowserCanvas
interface
to a more platform specific interface in order to access added
functionality. Examples of this are given at
IMozillaBrowserCanvas
Component getComponent()
IBrowserCanvas
down to a Component
This is useful for adding the IBrowserCanvas
to ContainersString getProductName()
String getVersion()
String getWebRendererVersion()
String getCompanyName()
void undo()
void redo()
boolean canUndo()
boolean canRedo()
void copy()
void cut()
setHTMLEditingMode(true)
has been
called on the IBrowserCanvas
void selectAll()
IBrowserCanvas
void loadURL(String url)
url
- The URL of the resource to load.void loadURL(URL url)
url
- The URL of the resource to load.void stopLoad()
void reload(int flags)
flags
- Defines the operation of reload using the RELOAD_* variables.RELOAD_NORMAL
,
RELOAD_BYPASS_CACHE
,
RELOAD_BYPASS_PROXY
,
RELOAD_BYPASS_PROXY_AND_CACHE
boolean canGoBack()
void loadHTML(String html, String relativePath)
IBrowserCanvas
html
- - A string containing the HTML code to displayrelativePath
- - The relative path from the current working directory to load images from
note: localPath should point to writable location. with set protocol prefix like file:/// and / as last character is essential
example file:///E:/htmlresources/
If localPath is an empty string then current application path used as an absolute base path for files.
Example Usage:
//Relative file
File file = new File("mypages");
browser.loadHTML(htmlString, file.toURL().toString());
void loadHTML(byte[] HTML, String relativePath)
IBrowserCanvas
HTML
- - A byte array containing the HTML code to displayrelativePath
- - The relative path from the current working directory to load images from
note: localPath should point to writable location. with set protocol prefix like file:/// and / as last character is essential
example file:///E:/htmlresources/
If localPath is an empty string then current application path used as an absolute base path for files.
Example Usage:
//Relative file
File file = new File("mypages");
browser.loadHTML(htmlString, file.toURL().toString());
void loadHTML(InputStream HTMLStream, String relativePath)
IBrowserCanvas
HTMLStream
- - An InputStream containing the HTML code to displayrelativePath
- - The relative path from the current working directory to load images from
note: localPath should point to writable location. with set protocol prefix like file:/// and / as last character is essential
example file:///E:/htmlresources/
If localPath is an empty string then current application path used as an absolute base path for files.
Example Usage:
//Relative file
File file = new File("mypages");
browser.loadHTML(htmlString, file.toURL().toString());
boolean canGoForward()
true
if goBack()
has been previously calledvoid goBack()
void goForward()
String getTitle()
title
tag.String getURL()
void enableProxy()
disableProxy()
void disableProxy()
enableProxy()
boolean isProxyEnabled()
enableProxy()
,
disableProxy()
ProxySetting getProxyProtocol(int protocol)
ProxySetting
protocol
- Identify which protocol settings to retrievevoid setProxyProtocol(ProxySetting proxy)
ProxySetting
define a single protocol at a time.
This function only sets the proxy protocol. The proxy needs to be explicitly enabled for it to be active.proxy
- The proxy settings for a single protocol.enableProxy()
,
disableProxy()
String getProxyBypasses()
void setProxyBypasses(String urls)
www.jadeliquid.com
bypasses for that specific URL
.jadeliquid.com
bypass jadeliquid domain
.gnome.org, .kde.org
bypass gnome.org and kde.org
domains
urls
- Domains to bypass the proxy.void autoconfigureProxy(String url)
url
- URL of proxy automatic configuration settingIDocument getDocument()
IDocument
is only valid while the current page is loaded.
This function should not be called until the NetworkEvent onDocumentComplete has fired.void allowPopups(boolean bOnOff)
bOnOff
- set to false to disable popupsboolean getAllowPopups()
boolean getJavascriptEnabled()
true
if JavaScript is enabled.setJavascriptEnabled(boolean)
void setJavascriptEnabled(boolean bOnOff)
getJavascriptEnabled()
IHistory getHistory()
void saveToFile(String filename)
filename
- The path and name of the file to save the document asvoid enableDefaultContextMenu(boolean onOff)
onOff
- Set to true
to display the context menu on right mouse click.getDefaultContextMenuStatus()
boolean getDefaultContextMenuStatus()
true
if context menu is enabled.enableDefaultContextMenu(boolean)
boolean getHTMLEditingMode()
setHTMLEditingMode(boolean)
Default is falseboolean getPopupParentWindow()
IBrowserCanvas
Default is falsevoid setHTMLEditingMode(boolean onOff)
By default this is set to false.
onOff
- set to true to enable editing modeboolean isScrollBarsVisible()
void loadURL(int NavConstants, String strURL, byte[] POSTData, String TargetFrameName, String Headers)
The NavConstants
parameter exists only for backwards
compatibility and has no effect; callers should pass 0.
NavConstants
- for backwards compatibility onlystrURL
- POSTData
- TargetFrameName
- Headers
- void paste()
setHTMLEditingMode(true)
has been
called on the IBrowserCanvas
void print(int Options)
Options
- defined by PRINT_* flags.void print(int Options, PrinterJob printerJob)
Options
- defined by PRINT_* flags.printerJob
- The PrinterJob
to use to print.void setPrintRequestAttributeSet(PrintRequestAttributeSet attributes)
PrintRequestAttributeSet
object for following print calls
on this browser. Can set to null to clear.
The actual attribute set used will be a synchronized copy of the given attribute set. Changes made to the set by print calls will not be visible in the original set.
attributes
- PrintRequestAttributeSet getPrintRequestAttributeSet()
PrintRequestAttributeSet
on the browser.int printPreview()
IBrowserCanvas
a print preview of the current page.
To leave print preview mode, call this method again.IBrowserCanvas printPreviewInNewWindow(boolean show)
IBrowserCanvas
, in which the current
page is loaded. The printPreview()
method is then called
on this browser. If the show parameter is set to true, this will also
add the browser to a new JFrame
and set it to visible.
Note: since this reloads the page, the preview may be slightly different to the page.
show
- set to true to show in a new framevoid setPrintBackground(boolean onOff)
onOff
- boolean true enables images/colors.void setPrinterMargin(int aMarginTop, int aMarginBottom, int aMarginLeft, int aMarginRight)
aMarginTop
- aMarginBottom
- aMarginLeft
- aMarginRight
- int getPrinterMarginTop()
int getPrinterMarginBottom()
int getPrinterMarginLeft()
int getPrinterMarginRight()
void setPopupParentWindow(boolean bOnOff)
bOnOff
- void showScrollBars(boolean bShow)
bShow
- true
to display native scrollbarsvoid setPrefProperty(String pref, boolean onOff)
pref
- The property to set.onOff
- The value to set it to.void setPrefProperty(String pref, int intPref)
pref
- The property to set.intPref
- The value to set it to.void setPrefProperty(String pref, String stringPref)
pref
- The property to set.stringPref
- The value to set it to.void addBrowserListener(BrowserListener listener)
listener
is null
, no exception is
thrown and no action is performed.listener
- The browser listener to add.removeBrowserListener(BrowserListener)
void addJavascriptListener(JavascriptListener listener)
listener
is null
, no
exception is thrown and no action is performed.listener
- The JavaScript listener to add.removeJavascriptListener(JavascriptListener)
void addNetworkListener(NetworkListener listener)
listener
is null
, no
exception is thrown and no action is performed.listener
- The network listener to add.removeNetworkListener(NetworkListener)
void addMouseListener(MouseListener listener)
listener
is null
, no
exception is thrown and no action is performed.listener
- The mouse listener to add.removeMouseListener(MouseListener)
,
IOptionsService.setSuppressSecondClickEvent(boolean)
void addKeyListener(KeyListener listener)
listener
is null
, no
exception is thrown and no action is performed.listener
- The Key listener to add.removeKeyListener(KeyListener)
void addWindowListener(WindowListener listener)
WindowListener
attached, the IBrowserCanvas
will no longer automatically spawn popup windows.listener
- The window listener to add.removeWindowListener(WindowListener)
void addPromptListener(PromptListener listener)
listener
- the prompt listener to add.removePromptListener(PromptListener)
void addAppletListener(AppletListener listener)
AppletListener
that will receive events when an applet
is created in this browser.listener
- the applet listener to addremoveAppletListener(AppletListener)
void removeWindowListener(WindowListener listener)
listener
- the listener to remove.void removeBrowserListener(BrowserListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.listener
- The browser listeneraddBrowserListener(BrowserListener)
void removeJavascriptListener(JavascriptListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.listener
- The JavaScript listeneraddJavascriptListener(JavascriptListener)
void removeNetworkListener(NetworkListener listener)
listener
is null
, or listener
has not
been previously added as a listener, no exception is thrown and no action
is performed.listener
- The network listeneraddNetworkListener(NetworkListener)
void removeMouseListener(MouseListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.listener
- The mouse listeneraddMouseListener(MouseListener)
void removeKeyListener(KeyListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.listener
- The Keyboard listener to remove.addKeyListener(KeyListener)
void removePromptListener(PromptListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.listener
- The Prompt listener to remove.void removeAppletListener(AppletListener listener)
AppletListener
from this browser, so that
it will no longer receive applet events. If the given listener is
null
or has not been added to this browser, this method does
nothing.listener
- the applet listener to removeaddAppletListener(AppletListener)
void executeScript(String javascriptBody)
javascriptBody
- The script to run.NetworkListener
,
addNetworkListener(NetworkListener)
,
setJavascriptEnabled(boolean)
String executeScriptWithReturn(String javascriptBody)
Returns the result of executing this script as a string
e.g: executing the following script:
" var myVariable='hello';myVariable;"
Will return the string "hello"
javascriptBody
- The script to runNetworkListener
,
addNetworkListener(NetworkListener)
,
setJavascriptEnabled(boolean)
void httpPOST(String strURL, String POSTData)
"name1=val1"
You can pass in multiple parameters
by separating them with the &
symbol. e.g.:
"name1=val1&name2=val2"
strURL
- POSTData
- void httpPOST(String strURL, File file, String fileVariableName, String additionalPOSTData)
strURL
- file
- fileVariableName
- additionalPOSTData
- void httpPOST(String strURL, File file, String fileVariableName)
strURL
- file
- fileVariableName
- boolean getBoolPrefProperty(String propName)
propName
- the name of the property to retrieve.int getIntPrefProperty(String propName)
propName
- the name of the property to retrieve.String getStringPrefProperty(String propName)
propName
- the name of the property to retrieve.boolean isCacheDisabled()
true
indicates the cache is disabled.void disableCache()
enableCache()
void enableCache()
disableCache()
void addBlockedURL(String strURL)
strURL
- full URL to add to blocked list.removeBlockedURL(String)
void removeBlockedURL(String strURL)
strURL
- full URL to remove from blocked list.addBlockedURL(String)
String getSelectedText()
void highlightSelectedText(Color color)
color
- the color to use for highlighting.void enableCookies()
disableCookies()
void disableCookies()
enableCookies()
boolean isCookiesEnabled()
true
if cookies feature is enabled.disableCookies()
,
enableCookies()
void enablePlugins(boolean toEnable)
toEnable
- true to enable, false to disable plugins.getPluginService()
,
isPluginsEnabled()
,
IMozillaBrowserCanvas.setAppletMode(int)
boolean isPluginsEnabled()
enablePlugins(boolean)
IPluginService getPluginService()
IPluginService
object that can be used to configure
plugin support and plugin options.isPluginsEnabled()
,
IMozillaBrowserCanvas.setAppletMode(int)
String makeImageUrl(BufferedImage img)
img
- the image.#removeImage(String)
void insertHTML(String strHTMLText)
String getCookie(String URL)
URL
- getCookie()
,
setCookie(String)
,
setCookie(String, String)
String getCookie()
getCookie(String)
,
setCookie(String)
,
setCookie(String, String)
void setCookie(String Value)
Value
- the cookie value.getCookie(String)
void setCookie(String URL, String Value)
URL
- the domain for the cookie.Value
- the value for the cookie.getCookie(String)
void deleteCookies()
void sendKeyPressToElement(int keyCode, int modifiers)
keyCode
- A key code, selected from the KEY_CODE constants.modifiers
- A key modifier, selected from the KEY_MODIFIER constants.KEY_CODE_BACKSPACE
,
KEY_CODE_DELETE
,
KEY_CODE_TAB
,
KEY_MODIFIER_CTRL_DOWN
,
KEY_MODIFIER_SHIFT_DOWN
void increaseTextZoom()
getZoomService()
void decreaseTextZoom()
getZoomService()
IZoomService getZoomService()
IZoomService
object that can be used to manipulate
the browser's full-page-zoom functionality.IZoomService.getFullZoom()
,
IZoomService.setFullZoom(double)
,
increaseTextZoom()
,
decreaseTextZoom()
Node getW3CDocument()
BufferedImage saveToBufferedImage(boolean bWholePage, boolean bKeepAlpha)
bWholePage
- if true returns the whole page not just what is visiblekeepAlpha
- specifies whether to create the BufferedImage using an alpha componentint savePageToBitmapImage(String strLocalFileName, boolean full)
strLocalFileName
- Full path to the new image file.full
- -- true - saves whole page
-- false - only visible part of pagevoid setPreferredSize(int width, int height)
width
- preferred width.height
- preferred height.IBrowserCanvas#getPreferredSize()
void disableHTTPSDialog(boolean onOff)
onOff
- true
Disable security warning dialogs.boolean getdisableHTTPSDialog()
void enableImageLoading(boolean enable)
enable
- true to load images, false to disable them. This is true by default.void dispatchClickEventToPoint(int x, int y)
x
- y
- void setHTTPHeadersEnabled(boolean enable)
Interception is enabled by default. Disabling it can improve performance in certain cases.
enable
- true
if HTTP headers should be interceptedNetworkListener.onHTTPInterceptHeaders(com.webrenderer.swing.event.NetworkEvent)
,
getHTTPHeadersEnabled()
boolean getHTTPHeadersEnabled()
true
if HTTP header interception is enabledsetHTTPHeadersEnabled(boolean)
IOptionsService getOptionsService()
IOptionsService
object that can be used to manipulate
various browser options and preferences.