The Mozilla
Organization
Our Mission
Who We Are
Getting Involved
Community
Editorials
What's New
Newsbot
Development
Roadmap
Module Owners
Blue Sky
Projects
Status
Tools
Products
Source Code
Binaries
Documentation
License Terms
Bug Reports
Quality
Search
Feedback

Java API for WebShell

This document describes the Java API for WebShell, also known as the java webclient.

Pre mozilla.org history

Requirements

This section describes the requirements you need before building the webclient project.
    • JDK1.1.7 or later (on Linux, you will need JDK1.2 or later)
    • a built mozilla M8 tree
    • a built mozilla java util package

Getting and Building the Code

Getting the Code

  1. You must first grab the latest mozilla milestone source tarball. This can be found at http://www.mozilla.org/download-mozilla.html.

  2. cd to your newly created mozilla directory and Follow the steps for getting mozilla via CVS, but instead of doing the SeaMonkeyAll thing type: cvs update -d -P java.

Building the Code

  1. Build the m8 tarball using the instructions found at http://www.mozilla.org/build/

  2. Follow the steps in the mozilla/java/README and mozilla/java/webclient/README files.

NOTE: At this point only debug builds (MOZ_DEBUG=1) are known to work. Also, the build is only currently designed for NT4.0 and Linux, but Solaris support is coming soon. If you make changes to the build to get it to work on other platforms, mail them to me.

Using the webclient

    There is an example browser in the java-webclient distribution that illustrates how to use the basic webclient features. This class is included by reference here [1] for your convenience. Note that the referenced document may be out of date with respect to the actual source tree.

    Basically, you create yourself a BrowserControlCanvas, which is a subclass of java.awt.Canvas, and add it into your display hierarchy.



	// Create the browser
	BrowserControlCanvas browser  = 
	               BrowserControlCanvasFactory.newBrowserControlCanvas();
	add(browser,      BorderLayout.CENTER);

	
      


public void actionPerformed (ActionEvent evt) {
    String command = evt.getActionCommand();
    
    try {
	if (command.equals("Back")) {
	    if (browserControl.canBack()) {
		browserControl.back();
		int index = browserControl.getHistoryIndex();
		String newURL = browserControl.getURL(index);
		
		System.out.println(newURL);
		
		urlField.setText(newURL);
	    }
	}
	else if (command.equals("Forward")) {
	    if (browserControl.canForward()) {
		browserControl.forward();
		int index = browserControl.getHistoryIndex();
		String newURL = browserControl.getURL(index);
		
		System.out.println(newURL);
		
		urlField.setText(newURL);
	    }
	}
	else if (command.equals("Stop")) {
	    browserControl.stop();
	}
	else {
	    browserControl.loadURL(urlField.getText());
	}
    }
    catch (Exception e) {
	System.out.println(e.toString());
    }
} // actionPerformed()

	
      
API documentation is available here, [2].

References


Ed Burns
Last modified: Wed Aug 4 17:02:44 PDT 1999

Copyright © 1998-1999 The Mozilla Organization.