Re: Some code to share

Hi Chi-chi...

Couldn't run your app -- kept bombing the JVM ;-(

1) Setting the display size in showDisplay()

The intent is that each 'display' that you add through the panel= keyword will have it's own size set. There is no explicit 'overall' size.

So, if you want both 'displays' to be equal in size, then when you do the showDisplay() for each of them, use exactly the same values for height= and width= keywords. This will work fine (until the user resizes the window, of course ;-)

If you need something to set the overall size, or to make the JFrame not resizable, then you can modify the 'myFrame' class inside subs.py.

2) Errors when switching between Sim3DAudio and web browser

What do you mean "switch to/from" the browser? Just bringing it to the focus on your desktop? If so, this looks like a Java3D bug...

3) Optional extra: converting from .py to .java

jythonc is the only thing I know to do this. I would recommend making a JAR file, and using the 'core' option -- this will then put everything related to Jython into the JAR file.

If you haven't seen the page at:
<http://www.jython.org/docs/jythonc.html>
I would recommend it.

I'd like to turn Sim3DAudio into a Java app. Yes, I know about jythonc. I've tried invoking it on sim3Daudio.py (via changing directory to the jythonc folder) but that didn't work. Here comes the dreaded classpath question...mine looks like this: SET PATH=c:\vtk40\bin;c:\j2sdk1.4.1_01\bin;c:\j2sdk1.4.1_01\jre\bin;c:\jython\jython.jar;c:\visad\visad_src-2.0.jar;%PATH%
set CLASSPATH=c:\visadjython\visad.jar;.
Is that wrong?

Yes. You need to have the jython.jar in your CLASSPATH as well. I always leave my CLASSPATH unset, and use the -cp (or -classpath) option on the command line. For example, my script (in Win2K) to run jythonc is:

java -mx256m -D"python.home=c:\jython-21"
-D"python.path=.\;c:\jython-21\Lib;c:\jython-21\Tools\jythonc"
-classpath
"c:\jython-21\jython.jar;c:\src\visad\python;c:\src;c:\src\visad.jar"
org.python.util.jython "\jython-21\Tools\jythonc\jythonc.py" %1 %2 %3 %4
%5 %6 %7 %8 %9

(all one line).


How do you go about compiling a .py file that imports from other .py files (as this does with subs.py) into a .java file? Is it possible to turn Jython 'scripts' into .class files? And how/where do you include visad.jar....

The 'core' option should compile everything needed. visad.jar should be in the classpath, both when you compile and when you run. Again, best to put the output into a JAR file.


--
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Phone/VoiceMail: 608.262.2759


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: