|
|
import com.webrenderer.*;
To create a WebRenderer browser with WebRenderer simply add the following:
//Core
call to enable the 30 day trial BrowserFactory.setLicenseData("username",
"serial"); //Creating the browser
instance IBrowserCanvas browser
= BrowserFactory.spawnMozilla()
OR you can also spawnInternetExplorer()
or spawnSafari() - InternetExplorer is only
available to Windows platforms and Safari
is only available on Apple Mac OSX.
Example:
public JPanel
browserPanel(){ JPanel panel = new JPanel(new
BorderLayout()); IBrowserCanvas browser =
BrowserFactory.spawnInternetExplorer(); panel.add(BorderLayout.CENTER,
(IEBrowserCanvas)browser); return panel; }
A close look at the Example
The
JPanel is created with a layout manager (BorderLayout) that suits the browser,
which expands to the size of the JPanel. IBrowserCanvas is the WebRenderer main
Interface that has many useful functions. An IBrowserCanvas object is spawned by
calling BrowserFactory.spawnInternetExploerer or BrowserFactory.spawnMozilla().
The browser is then cast to an IEBrowserCanvas a class inheriting from
Canvas to make WebRenderer a component and added to the panel in the Center. The
reason browser is addded to the Center is to take up the remaining space of the
sized panel. The panel is returned to the calling function. WebRenderer
can also be cast to a standard Canvas
eg:
Canvas canvas =
(Canvas)browser; canvas.setSize(100, 100);
The difference between
spawnMozilla, spawnInternetExplorer and spawnSafari
Mozilla can only be
spawned if you have downloaded the enterprise version (6mb). This version
includes the Micro version. The enterprise version runs off local components that are
distributed with WebRenderer and requires no software to be installed on the
computer to make WebRenderer run. WebRenderer full distribution is a self
contained HTML browser. WebRenderer Micro relies on Internet Explorer (on Windows)
or Safari (on OSX) to be on
the users system. The Micro edition uses Internet Explorer or Safari libraries to display
HTML. The Mozilla
based enterprise WebRenderer build runs on multiple platforms including Windows,
Linux, OSX, JavaDesktop and Solaris.
|