Re: JLink
- To: mathgroup at smc.vnet.net
- Subject: [mg41220] Re: JLink
- From: "solex" <solex at nowhere.com>
- Date: Thu, 8 May 2003 09:32:50 -0400 (EDT)
- References: <200305070757.DAA13332@smc.vnet.net> <b9ajl9$eeg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Werner, Here is the relevant JLink code, the Java code is a simple form. As I stated in my previous post it appears that every time the mathematica code is run the values selected from the Java form are remembered in some sort of an array. Thanks, Dan InterfaceWindow := JavaBlock[ Module[ {frm, NewGui, clsBtn, SubBtn, closeListener, Slistener, Clistener, vinText, parkText, surText, vinRadio, type, vinSpread}, InstallJava[]; AddToClassPath["C:\Airplane\classes"]; LoadJavaClass["airplane.GInterface2"]; NewGui = JavaNew["airplane.GInterface2"]; frm = JavaNew["javax.swing.JFrame"]; frm@setSize[500, 350]; JavaShow[NewGui@makeDisplay[frm]]; closeListener = JavaNew["com.wolfram.jlink.MathWindowListener"]; frm@addWindowListener[closeListener]; closeListener@setHandler["windowClosing", "frm@dispose[];EndModal[];&"]; SubBtn = NewGui@getSubmitButton[]; clsBtn = NewGui@getCloseButton[]; Slistener = JavaNew["com.wolfram.jlink.MathActionListener"]; Slistener@setHandler["actionPerformed", "SbtnFunc"]; SubBtn@addActionListener[Slistener]; Clistener = JavaNew["com.wolfram.jlink.MathActionListener"]; Clistener@setHandler["actionPerformed", "CloFunc"]; clsBtn@addActionListener[Clistener]; CloFunc[event_, _] := JavaBlock[ frm@dispose[]; ReleaseJavaObject[frm, NewGui, clsBtn, SubBtn, closeListener, Slistener, Clistener, vinText, parkText, surText, vinRadio, type, vinSpread]; EndModal[]; ]; SbtnFunc[event_, _] := JavaBlock[ type = StringTake[frm@getType[], 2]; vintage = frm@getVintageYear[]; park = .01*ToExpression[frm@getParked[]]; surplus = .01*ToExpression[frm@getSurplus[]]; vinSpread = frm@getVintageSpread[]; Print["Type is ", type, " Vintage is ", vintage, " Park is ", park, " Surplus is ", surplus, " Vintage Spread is ", vinSpread]; // ReleaseJavaObject[vintage, park, surplus, temp, vinSpread, type]; ]; DoModal[]; ]; ] "Werner Schuster" <schuster at deltasoft.at> wrote in message news:b9ajl9$eeg$1 at smc.vnet.net... > solex wrote: > > Hello, > > Is there any reference on the web for JLink. I posted a question last week > > and did not get a response? > > Thanks, > > Did you take a look at the documentation that comes with J/Link; > The J/Link Manual should contain just about everything you need to know; > > Concerning your question from last week: > You need to post some source code; from your descritpion it's not clear > what the problem is; (just the Mathematica code that interacts with the > Java code, and vice versa); > > > murphee > -- > Werner Schuster (murphee) > Student of SoftwareEngineering and KnowledgeManagement > Technical University of Graz > >
- References:
- JLink
- From: "solex" <solex@nowhere.com>
- JLink