Module JavaApplet

module JavaApplet: sig .. end
Support for Java applets.

In order to produce a jar archive containing an applet, it is necessary to link the application with the -applet k command-line switch, where k designates the kind of applet (AWT-, Swing-, or Graphics-based). An applet class will be generated, with the name pack.ocamljavaApplet where pack can be set using the -java-package pack command-line switch.

When linking with the -applet k command-line switch, the last module to be linked has to be compatible with one of the module types of the JavaApplet module, the exact module type depending on the value of k. The following table gives the module types and default implementations (modules compatibles with the module types, with only no-op functions) for the different applet kinds.

The various kinds of applets.
parameter to -applet module type default implementation
awt AWT Default_AWT
swing Swing Default_Swing
graphics Graphics Default_Graphics



Applet information

 
type parameter = {
   param_name : JavaString.t; (*parameter name.*)
   param_type : JavaString.t; (*parameter type.*)
   param_desc : JavaString.t; (*parameter description.*)
}
The type of parameters, describing parameters accepted by an applet.
 
type parameter_info
The type of parameter info, as returned by the getParameterInfo(...) method.
 
val parameter_info_of_list : parameter list -> parameter_info
Converts a list of parameters into a parameter info, preserving the order of elements.
 

AWT-based applets

 
type awt = java'applet'Applet java_instance
Shorthand for the type of AWT applets.
 
module type AWT = sig .. end
The module type for applets linked with -applet awt.
 
module Default_AWT: AWT
Default implementation for AWT applets.
 

Swing-based applets

 
type swing = javax'swing'JApplet java_instance
Shorthand for the type of Swing applets.
 
module type Swing = sig .. end
The module type for applets linked with -applet swing.
 
module Default_Swing: Swing
Default implementation for Swing applets.
 

Graphics-based applets

 
type graphics_event = {
   mouse_x : int; (*X coordinate of the mouse.*)
   mouse_y : int; (*Y coordinate of the mouse.*)
   button : bool; (*true if a mouse button is pressed.*)
   keypressed : bool; (*true if a key has been pressed.*)
   key : char; (*the character for the key pressed.*)
}
Equivalent to Graphics.status, copied to avoid dependency.
 
module type Graphics = sig .. end
The module type for applets linked with -applet graphics.
 
module Default_Graphics: Graphics
Default implementation for Graphics applets.