[[#wd Lookup TitleRecipe27 ]]

Overview

This recipe describes how to put one of these fancy Java-Applets on a page using Coast.

Preconditions

Steps to do:

  1. Define the interface to jour java applet and implement your class.

  2. Add the definition for /AppletPath and the specific MIME-Type to the Server.any (more details see [[#wd Lookup Recipe14 ]]):
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/AppletPath		    "/static/applets/""
    	 	"..."
    		"/Ext2MIMETypeMap {"
    		"	/gif	"image/gif""
    		"	/jpg	"image/jpeg""
    		"	/css	"text/css""
    		"	/class	"text/plain""
    		"}"
    	}
    }]]
    
  3. Make the necessary entries in the config.any:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/Renderers {"
    		"..."
    		"/AppletRenderer 		{	Applet			}"
    		"..."
    	}
    }]]
    
  4. Write an HTML-Template which calls the AppletRenderer and write a Renderer specification which uses it. You may use ContextLookupRenderers or something similar to fill in parameters.
    Ex4Page.any:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/ButtAppl {"
    		"	/Applet {"
    		"		/Options "width=380 height=90"     # size of the whole applet"
    		"		/CodeBase 			{ /Lookup AppletPath }"
    		"		/Applet		 		"AppletButton.class""
    		"		/Params {"
    		"			/WINDOWCLASS	{ "TestWindow" }"
    		"			/BUTTONTEXT		{ "Creates a new window ..."}"
    		"			/WINDOWTITLE	{ "my Window" }"
    		"			/WINDOWWIDTH	{ "500"	}"
    		"			/WINDOWHEIGHT	{ "300"	}"
    		"			/FONT			{ "SansSerif"	}"
    		"		}"
    		"	}"
    		"}"
    	}
    }]]
    
    As text on this java button may be written:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/WrittenOnButton {"
    		"	/String {"
    		"		/Default "dynamically rendered text""
    		"	}"
    		"}"
    	}
    }]]
    
  5. Put the Renderer on your page.
    Ex4Page.html:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"..."
    		"<p><center>[[#wd Lookup ButtAppl ]]</center>"
    		"..."
    	}
    }]]
    

Remarks

You might have some problems with this recipe because of one or more of the following items:

Glossary

Related Topics