Java, Graphics Output, MathCanvas
- To: mathgroup at smc.vnet.net
- Subject: [mg29355] Java, Graphics Output, MathCanvas
- From: "Torsten Hartwig" <torstenhartwig at web.de>
- Date: Thu, 14 Jun 2001 02:27:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
im new to mathematica, so i hope you can help me. i've installed mathematica
v4.1 and i created a little java application that works with Jlink. one can
feed a function and the application returns the derivation of this
function. now i tryd to display the answer as a graphic(or a typeset, i dont
know the difference) in a MathCanvas, but it doesn't work. i even tested the
example GraphicsApp thats in the Jlink folder, but that doesnt work, too. it
is possible to display mathematica-expression in a MathCanvas at all ? i use
VisualCafe4.1 in combination with JDK1.2.
the code relevant to the problem is as follows:
instance-variable:
MathCanvas MathCan = new MathCanvas();
constructor:
this.MathCan.setBounds(12,86,372,240);
this.MathCan.setBackground(Color.lightGray);
this.MathCan.setImageType(this.MathCan.TYPESET);
or
this.MathCan.setImageType(this.MathCan.GRAPHICS);
computation-method:
KernelLink link = null;
try
{
link = MathLinkFactory.createKernelLink("-linkmode launch -linkname
'C:/Programme/Wolfram Research/Mathematica/4.1/mathkernel.exe'");
}
catch (MathLinkException e)
{
System.out.println("No KernelLink");
}
try
{
this.MathCan.setMathCommand("D[3x^2,x]");
or
this.MathCan.setMathCommand("Plot[x,{x,0,1}]");
}
catch (MathLinkException e)
{
System.out.println("Error");
}
link.close();
thanks,
torsten