This uses the dynamic byte-code generator facility in Omegahat to
create a new Java class with a given name. By default, the new class
RForeignReference class and implements a
specifiable collection of Java interfaces. Each method in these
interfaces is implemented by calling the corresponding
R function in the R reference object.
1 2 3
the (fully qualified) name of one or more
Java interface classes that the new class should implement.
The methods in these interfaces are implemented as calls to the
correspondingly named R function in the R object identified by
the name of the new class to be created.
the name of the
Java class to which is to be used as the dynamic compiler.
This is rarely specified, but allows one to use classes that
implement the code differently, e.g. by extending
logical value indicating whether the new class
should be loaded into the Omegahat list of available classes.
If this is
Duncan Temple Lang
1 2 3 4 5 6 7 8 9 10 11 12 13 14
## Not run: jdynamicCompile("java.awt.event.ActionListener", "RActionListener") l <- .JNew("RActionListener", foreignReference(list(actionPerformed=function() print("ok")))) button$add(l) ## End(Not run) ## Not run: def <- jdynamicCompile("java.awt.event.ActionListener", "RActionListener", load=F) def$write() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.