Re: Java, Graphics Output, MathCanvas
- To: mathgroup at smc.vnet.net
- Subject: [mg29369] Re: Java, Graphics Output, MathCanvas
- From: tgayley at wolfram.com (Todd Gayley)
- Date: Fri, 15 Jun 2001 02:23:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Torsten, Your code looks reasonable, so let's first figure out what the problem is with the example GraphicsApp program. In what way does it not work for you? Does the program launch normally but just not display output when you click the Evaluate button? Does the Mathematica front end launch along with the kernel when you start GraphicsApp (it should)? Please give as many details as you can about what happens. --Todd Gayley Wolfram Research On Thu, 14 Jun 2001 06:35:06 +0000 (UTC), "Torsten Hartwig" <torstenhartwig at web.de> wrote: >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 > > >