os_applet


An embedded applet.

An os_applet embeds a Java applet within a page. An applet is described by the name of the file that contains its main class, and by its initial width and height in pixels. These attributes are specified through the constructors and can be modified by the code() , width() , and height() member functions.

An applet consists of one or more files. By default, the names of the main class file and any subordinate files are relative to the URL of the page in which the applet is embedded. If the files are located elsewhere, a base code URL must be specified through either the constructor or the codebase() member function. Applet file names are then relative to the specified base code URL.

The alignment of the applet with respect to surrounding text can be specified through the align() member function. When the alignment is set to left or right, text flows around the applet. The amount of white space surrounding the applet can be specified in pixels through the hspace() and vspace() member functions.

Parameters are supplied to an applet through os_parameter objects. Parameters are inserted into an os_applet through either the add() member function or operator<< .

Declaration

#include <ospace/web/applet.h>
class os_applet : public os_element_group

Enums

 
enum os_applet::alignment
  {
  left,       // Aligns the applet along the left margin and allows text to flow beside.
  right,      // Aligns the applet along the right margin and allows text to flow beside.
  top,        // Aligns the top of applet with the line's text.
  texttop,    // Aligns the top of applet with the top of tallest text on line.
  middle,     // Aligns the middle of applet with the line's text.
  absmiddle,  // Aligns the middle of applet with the middle of the line's text.
  baseline,   // Aligns the bottom of the applet with the baseline of the line's text.
  bottom,     // Aligns the bottom of the applet with the line's text.
  absbottom   // Aligns the bottom of the applet with the bottom of the line's text.
  };
 

Interface

Constructor
os_applet( const string& code , int width , int height )
Constructs an embedded applet, initially width pixels wide and height pixels high, with main class in filename code .
Constructor
os_applet( const string& code , const string& codebase , int width , int height )
Constructs an embedded applet, initially width pixels wide and height pixels high, with main class in filename code , base code, and resource URL codebase .
align
int align() const
Returns the alignment of the applet, or os_element::use_default if not set.
align
os_applet& align( alignment align )
Sets the applet alignment to align and returns a reference to the applet.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the applet.
code
string code() const
Returns the name of the file that contains the main class of the applet.
code
os_applet& code( const string& code )
Sets the main class filename to code and returns a reference to the applet.
codebase
os_applet& codebase( const string& codebase )
Sets the base code and resource URL to codebase , and returns a reference to the applet.
codebase
string codebase() const
Returns the base code and resource URL, or the empty string if not set.
height
os_applet& height( int height )
Sets the initial height of the applet to height pixels, and returns a reference to the applet.
height
int height() const
Returns the initial applet height, in pixels.
hspace
os_applet& hspace( int pixels )
Sets the horizontal space around the applet to pixels pixels, and returns a reference to the applet.
hspace
int hspace() const
Returns the horizontal space around the applet in pixels, or 0 if not set.
vspace
os_applet& vspace( int pixels )
Sets the vertical space around the applet to pixels pixels, and returns a reference to the applet.
vspace
int vspace() const
Returns the vertical space around the applet in pixels, or 0 if not set.
width
os_applet& width( int width )
Sets the initial width of the applet to width pixels, and returns a reference to the applet.
width
int width() const
Returns the initial applet width in pixels.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved