|
htmlApplet
Java applet class | [Previous] [Main] [Next] |
| htmlApplet encapsulates the <APPLET></APPLET> tags, and is used to specify a Java applet that runs in a web page. Applets can only be display by Java-enabled browsers. Java applets and written in the Java programming language and compiled into a file or files using a Java compiler. The Java programming language is beyond the scope of this document. For more information on Java, you may wish to visit the following web site:
| |
|
| |
| http://java.sun.com/docs/books/tutorial/
| |
|
| |
| Once a Java applet is compiled and ready for use, you can use the Code() method to specify the name of the applet. The Codebase() method is used to specify the name of the subdirectory or URL containing the applet file.
| |
|
| |
| Many applets require optional parameters for which specific methods cannot be created. To use such options, use the Param() method to specify applet-specific parameter names and values. You can also add htmlParam objects to an htmlApplet object using the Add() method or the << insertion operator, which have been overloaded to accept only htmlParam objects.
| |
|
| |
| Some browsers will not display applets unless their dimensions are specified. To ensure that the applet will display properly on the widest variety of browsers, use the Height() and Width() methods to specify the dimensions in pixels, or as a percentage of the display area.
| |
|
| |
| #include <dcmicro/htmlpp/applet.h>
| |
|
| |
| |
| htmlParam, htmlScript, htmlPlugIn
| |
|
| |
| typedef enum {
| |
| align_default = 0,
| |
| align_left,
| |
| align_center,
| |
| align_right,
| |
| align_justify
| |
| } Alignment ;
| |
|
| |
| typedef enum {
| |
| valign_default = 0,
| |
| valign_top = align_justify + 1,
| |
| valign_middle,
| |
| valign_bottom,
| |
| valign_baseline
| |
| } VerticalAlignment ;
| |
|
| |
| htmlApplet()
| |
| Constructs an empty Java applet object.
| |
|
| |
| htmlApplet( | const String& codebase_url,
| |
| const String& code,
| ||
| const String& height,
| ||
| const String& width )
| ||
| Constructs a Java applet object, specifying code as the name of the applet to load from the directory or URL codebase_url, using dimensions height and width (which may be expressed as percentages or pixels).
| |
|
| |
| htmlApplet( const htmlApplet& rhs )
| |
| Copy constructor.
| |
|
| |
| virtual ~htmlApplet()
| |
| Destroys the object.
| |
|
| |
| << | htmlApplet& operator<< ( const htmlParam& param )
| |
| Adds the parameter object param to the applet and returns a reference to the object.
| |
|
| |
| Add | virtual htmlObject FAR * Add( const htmlParam& param )
| |
| Adds the parameter object param to the applet, returning a pointer to the new object.
| |
|
| ||
| Code | htmlApplet& Code( const String& filename )
| |
| Sets the filename of the Java applet to load to filename, and returns a reference to the object. This value is required. All Java class files contain a name suffix of ".class".
| |
|
| ||
| Code | String Code() const
| |
| Returns the filename of the Java applet to load, or an empty string if not set.
| |
|
| ||
| Codebase | htmlApplet& Codebase( const String& file_directory_url )
| |
| Sets the directory containing the applet class file and any resources to file_directory_url, a URL for an absolute or relative pathname. A reference to the object is returned.
| |
|
| ||
| Codebase | String Codebase() const
| |
| Returns the directory pathname containing the applet class file and any resources as a string, or an empty string if not set.
| |
|
| ||
| Archive | htmlApplet& Archive( const String& archive_file )
| |
| Sets the filename to be downloaded and searched for the class file specified in the Code() method to archive_file, and returns a reference to the object. The archive file must contain a suffix of ".zip", but must not be compressed.
| |
|
| ||
| Archive | String Archive() const
| |
| Returns the archive name as a string, or an empty string if not set.
| |
|
| ||
| AltText | htmlApplet& AltText( const String& text )
| |
| Sets the text to be displayed by browsers that are unable to display Java applets to text, and returns a reference to the object.
| |
|
| ||
| AltText | String Archive() const
| |
| Returns the alternate text setting for the object, or an empty string if not set.
| |
|
| |
| Align | htmlApplet& Align( Alignment align )
| |
| Sets the horizontal alignment for the applet to align, and returns a reference to the object. Align() and VAlign() are mutually exclusive attributes.
| |
|
| |
|
|
| |
| VAlign | htmlApplet& VAlign( VerticalAlignment v_align )
| |
| Sets the vertical alignment for the applet to align, and returns a reference to the object. Align() and VAlign() are mutually exclusive attributes.
| |
|
| |
|
|
| |
| Align | int Align() const
| |
| Returns the alignment (horizontal or vertical) for the applet as an integer, or align_default if not set.
| |
|
| |
| Height | htmlApplet& Height( const String& pixels_or_percent )
| |
| Sets the applet height, and returns a reference to the object. An integer value for pixels_or_percent sets the height in pixels. A string containing a "%" character scales the applet height as a percentage of the parent window, frame, or content block. Both a height and width should be specified in order for the applet to display properly on the widest variety of browsers.
| |
|
| |
| Height | String Height() const
| |
| Returns the applet height as a string (representing pixel size or a percentage of the display), or an empty string if not set.
| |
|
| |
| Width | htmlApplet& Width( const String& pixels_or_percent )
| |
| Sets the applet width, and returns a reference to the object. An integer value for pixels_or_percent sets the width in pixels. A string containing a "%" character scales the applet width as a percentage of the parent window, frame, or content block. Both a height and width should be specified in order for the applet to display properly on the widest variety of browsers.
| |
|
| |
| Width | String Width() const
| |
| Returns the applet height as a string (representing pixel size or a percentage of the display), or an empty string if not set.
| |
|
| |
| HSpace | htmlApplet& HSpace( int pixels )
| |
| Sets the horizontal space between the applet and it's surroundings, and returns a reference to the object. If pixels is a negative value, the attribute is cleared.
| |
|
| |
| HSpace | int HSpace() const
| |
| Returns the horizontal space setting in pixels, or zero if not set.
| |
|
| |
| VSpace | htmlApplet& VSpace( int pixels )
| |
| Sets the vertical space between the applet and it's surroundings, and returns a reference to the object. If pixels is a negative value, the attribute is cleared.
| |
|
| |
| VSpace | int VSpace() const
| |
| Returns the vertical space setting in pixels, or zero if not set.
| |
|
| |
| EnableScript | htmlApplet& EnableScript( Boolean enable_javascript_access = TRUE )
| |
| Specifies whether or not the applet can access JavaScript on a page, and returns a reference to the object. If an applet attempt to access JavaScript without enabling this option, the browser will generate an exception. This method corresponds to the MAYSCRIPT attribute.
| |
|
| |
| IsScriptEnabled Boolean IsScriptEnabled()
| |
| Returns TRUE if the applet has permission to access JavaScript on a page, FALSE if not.
| |
|
| |
| Name | htmlApplet& Name( const String& name )
| |
| Sets the JavaScript-accessible name of the applet to name, and returns a reference to the object.
| |
|
| |
| Name | String Name() const
| |
| Returns the JavaScript-accessible name of the applet as a string, or an empty string if not set.
| |
|
| |
| Param | htmlApplet& Param( const String& name, const String& value )
| |
| Adds name and value as a custom parameter for the applet, then returns a reference to the object. Internally, an htmlParam object is created and the name and value arguments are passed to it.
| |
|
| |
| void Print( ostream& os ) const
| ||
| Outputs the object to os.
| |
|
| |
| Clone | htmlObject FAR * Clone() const
| |
| Returns a base-class pointer to a deep copy of the object.
| |
|
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
|
| |
