Uses a web browser to display : Browser HTML « SWT JFace Eclipse « Java

Uses a web browser to display

Uses a web browser to display

//Send questions, comments, bug reports, etc. to the authors:

//Rob Warner (
//Robert Harris (

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

 * This class uses a web browser to display Slashdot's home page
public class ShowSlashdot {
   * Runs the application
  public void run() {
    Display display = new Display();
    Shell shell = new Shell(display);
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {

   * Creates the main window's contents
   * @param shell the main window
  private void createContents(Shell shell) {
    shell.setLayout(new FillLayout());

    // Create a web browser
    Browser browser = new Browser(shell, SWT.NONE);

    // Navigate to Slashdot

   * The application entry point
   * @param args the command line arguments
  public static void main(String[] args) {
    new ShowSlashdot().run();


Related examples in the same category

1.Modify HTML title tagModify HTML title tag
2.Query DOM node valueQuery DOM node value
3.HTML ExplorerHTML Explorer
4.Web Browser Composite
5.Another SWT Browser DemoAnother SWT Browser Demo
6.SWT Browser ExampleSWT Browser Example
7.SWT Browser
8.Implements a web browser 2Implements a web browser 2
9.Implements a web browserImplements a web browser
10.Render HTML that includes relative links from memoryRender HTML that includes relative links from memory
11.Bring up a browserBring up a browser
12.Another SWT BrowserAnother SWT Browser
13.HTML Explorer based on JFaceHTML Explorer based on JFace