File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Jython/Python and the fly likes Calling method in Java App from Jython Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Calling method in Java App from Jython" Watch "Calling method in Java App from Jython" New topic
Author

Calling method in Java App from Jython

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

If I create a GUI using a Jython script file, I am not clear on how we contruct the event methods so that the non GUI "work" part of the app is handled outside of the Jything Interpreter. Or is this even possible?


GenRocket - A Test Data Generation Platform
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I'm afraid that you have exceeded the monthly capacity of this forum, come back later.
Gregg, what do you mean by "outside" of the Jython interpreter? Do you
mean back in the JVM? Got code?
[ October 29, 2003: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

What I mean is if I use Jython to construct a simple GUI in a file. Then in my java code I do
interpreter.execfile("gui.py");
That is all find and good. But if my GUI has Buttons, Menu's, etc I need the Action Events to reside in the java program itself, not in the script file. I don't really have any code yet because I need to find out if this is possible before I commit to doing it.
But for an example I found on the internet:

If this is my script file that I call from the java program, notice the:

I need that to call a method inside my Java application. I don't want all my event code in the script file. I hope that makes better sense.
I'm afraid that you have exceeded the monthly capacity of this forum, come back later.
I noticed this forum was a bit on the dormant side. I thought I would bring it back to life.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling method in Java App from Jython
 
Similar Threads
Any Resources for Jython ?
Jython?
This is for Mr Author--Bill
Jython books
Help - How to I tell java where my jython.py script is located in the Directory