This section shows you SWT Browser
In SWT, the class Browser of package org.eclipse.swt.browser allows to create a browser. In the given example, the class Browser implements the browser and allows the user to navigate through HTML documents. The class Text creates the text field for the URL.
The Listener class is called to perform the action on ToolItems. The method browser.back() navigate to the previous session, the method browser.forward() navigates to the next session, the method browser.refresh() refresh the current page, the method browser.stop() stops the loading and rendering activity. The method browser.setUrl(text.getText()) loads the URL by getting the text from the text box.
Following code loads the given URL:
Here is the code of BrowserExample.java
Output will be displayed as:
Posted on: October 24, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles