There are several methods in which XHTML content can be loaded into an instance of the EditLive! for Java Swing applet:

  • Using the Open Menu and Toolbar Items
  • Using the setDocument() method for ELJBean
  • Using the setBody() method for ELJBean

There is also a variety of methods that can be used to set the CSS style information for the instance of EditLive! for Java Swing. For information on how to set the CSS information for an instance of EditLive! for Java Swing, see the Using CSS in the Swing SDK article.

Using the Open Menu and Toolbar Items

Using the EditLive! for Java Swing Configuration File, developers can specify the Open dialog to be accessed via either a menu item or toolbar button. This dialog allows users to specify an XHTML document load into the instance of EditLive! for Java Swing.

These menu and/or toolbar items can added to an EditLive! for Java Configuration File by manually editing the configuration file. If manually editing a configuration file, see the Menu and Toolbar Item List, <menuItem> and <toolbarButton> sections of this SDK.

Using the setDocument() Method for ELJBean

The setDocument() method allows the developer to specify an entire XHTML document to load into EditLive! for Java Swing. The XHTML document is passed to the setDocument() method as a Java String.

Example
The following example depicts loading a simple XHTML document into an instance of EditLive! for Java using the setDocument() method.

ELJBean editLive = new ELJBean();
 
String htmlContent = new String("<html><head><title>Example Page</title></head><body><p>This is an example html page</p></body></html>");
 
editLive.setDocument(htmlContent);

Using the setBody() Method for ELJBean

The setBody() allows the developer to specify only the content to be loaded between the XHTML <body> tag in EditLive! for Java Swing. The XHTML content is passed to the setBody() method as a Java String.

Example
The following example depicts loading simple XHTML content into the <body> tag of an instance of EditLive! for Java Swing, using the setBody() method.

ELJBean editLive = new ELJBean();
 
String htmlContent = new String("<p>This is an example html page</p>");
 
editLive.setBody(htmlContent);