JLink and speeding up graphics display by java routine
- To: mathgroup at smc.vnet.net
- Subject: [mg36661] JLink and speeding up graphics display by java routine
- From: Blimbaum Jerry DLPC <BlimbaumJE at ncsc.navy.mil>
- Date: Wed, 18 Sep 2002 02:09:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I am trying to write an animation using JLink.....basically as follows...(using Mathematica 4.1, JLink 2.01 and java 1.4.1)... frm = createWindow[]; (* basically to create a MathFrame and a drawArea = MathCanvas *) Here is my drawing routine.... Map[(obj = drawMembrane[#]; drawArea@setMathCommand["obj"]; drawArea@repaintNow[]; Pause[.0001];) &, t ] t = time list ={0,.25,etc}.... and drawMembrane is a function that uses the time value to make a graphics plot......unfortunately, this routine draws the next time plot very slowly, plus I also notice that without the Pause[] statement, Mathematica only draws the graph for the final time value... Following an example in the JLink documentation, I have written the following java routine....which I saved in the same dir as MathFrame, etc.... public class My_DisplayGraphicsViaJava { public void displayGraphics(String cmds[]) { // declare String Array for Graphics Objects for (int i = 0; i < cmds.length-1; i++) drawArea.setMathCommand(cmds[i]); drawArea.repaintNow(); Thread.sleep(200);} } and then in Mathematica I have LoadJavaClass["My_DisplayGraphicsViaJava"]; My_DisplayGraphicsViaJava`displayGraphics["obj"]; (* where obj is the array of Graphics plots created *) But needless to say this dont work....LoadJavaClass responds by saying Class not Found.....so what should I do to correct this? Also , on the java routine, was i supposed to add: Extends MathFrame, etc....how will my java routine know what drawArea.setMathCommand is, etc.....am I also supposed to compile my java routine? thanks....jerry blimbaum NSWC panama city, fl