Package com.wolfram.jlink
Class MathFocusListener
java.lang.Object
com.wolfram.jlink.MathListener
com.wolfram.jlink.MathFocusListener
- All Implemented Interfaces:
java.awt.event.FocusListener
,java.util.EventListener
public class MathFocusListener extends MathListener implements java.awt.event.FocusListener
This class lets you trigger a call into Mathematica on the occurrence of a particular event.
Like all the MathXXXListener classes, it is intended to be used primarily from Mathematica, although it
can be used from Java code as well.
In response to a FocusEvent, objects of this class send to Mathematica:
userCode[theFocusEvent]userFunc is specified as a string, either a function name or an expression (like a pure function "foo[#]&"), via the setHandler() method.
-
Constructor Summary
Constructors Constructor Description MathFocusListener()
The constructor that is called from Mathematica.MathFocusListener(KernelLink ml)
You must use this constructor when using this class in a Java program, because you need to specify the KernelLink that will be used.MathFocusListener(java.lang.String[][] handlers)
This form of the constructor lets you skip having to make a series of setHandler() calls. -
Method Summary
Modifier and Type Method Description void
focusGained(java.awt.event.FocusEvent e)
void
focusLost(java.awt.event.FocusEvent e)
Methods inherited from class com.wolfram.jlink.MathListener
callMathHandler, callVoidMathHandler, getHandler, getLink, setHandler
-
Constructor Details
-
MathFocusListener
public MathFocusListener()The constructor that is called from Mathematica. -
MathFocusListener
You must use this constructor when using this class in a Java program, because you need to specify the KernelLink that will be used.- Parameters:
ml
- The link to which computations will be sent when FocusEvents arrive.
-
MathFocusListener
public MathFocusListener(java.lang.String[][] handlers)This form of the constructor lets you skip having to make a series of setHandler() calls. Use this constructor from Mathematica code only.- Parameters:
handlers
- An array of {meth, func} pairs associating methods in the FocusListener interface with Mathematica functions.
-
-
Method Details
-
focusGained
public void focusGained(java.awt.event.FocusEvent e)- Specified by:
focusGained
in interfacejava.awt.event.FocusListener
-
focusLost
public void focusLost(java.awt.event.FocusEvent e)- Specified by:
focusLost
in interfacejava.awt.event.FocusListener
-