Package com.wolfram.jlink
Class MathMouseListener
java.lang.Object
com.wolfram.jlink.MathListener
com.wolfram.jlink.MathMouseListener
- All Implemented Interfaces:
java.awt.event.MouseListener,java.util.EventListener
public class MathMouseListener extends MathListener implements java.awt.event.MouseListener
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 MouseEvent, objects of this class send to Mathematica:
userCode[theMouseEvent, theMouseEvent.getX(), theMouseEvent.getY(), theMouseEvent.getClickCount()]
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 MathMouseListener()The constructor that is called from Mathematica.MathMouseListener(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.MathMouseListener(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 voidmouseClicked(java.awt.event.MouseEvent e)voidmouseEntered(java.awt.event.MouseEvent e)voidmouseExited(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)Methods inherited from class com.wolfram.jlink.MathListener
callMathHandler, callVoidMathHandler, getHandler, getLink, setHandler
-
Constructor Details
-
MathMouseListener
public MathMouseListener()The constructor that is called from Mathematica. -
MathMouseListener
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 MouseEvents arrive.
-
MathMouseListener
public MathMouseListener(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 MouseListener interface with Mathematica functions.
-
-
Method Details
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-