From: syKim <re...@ne...> - 2001-02-22 02:45:19
|
Hi :) I'm trying swing programming in jython 2.0 I made simple text editor with InternalFrame however, when I executed it opens another applet window under appletviewer or netscape.. (It works on it but, not well) main applet window in appletviewer or netscape is just empty. what's problem on it? Source code : ---------------------------------------------------------------------------- ------------------------ import java from java.awt import * from java.awt.event import * from javax.swing import * from javax.swing.text import * class SmallEdit(JFrame): def exit(e) : java.lang.System.exit(0) frame=JFrame('test',visible=1,size=(400,300)) frame.getContentPane().setLayout(BorderLayout()) editor=JTextArea() editor.requestFocus() inner=JInternalFrame('newfile',1,1,1,1,visible=1) inner.setSize(200,150) scroll=JScrollPane(autoscrolls=1,preferredSize=(200,150)) port=self.scroll.getViewport() port.add(editor) inner.getContentPane().add('Center',scroll) desktop=JDesktopPane(preferredSize=(400,300)) desktop.add(inner) button = JButton('Exit',actionPerformed=exit) frame.getContentPane().add(desktop) frame.getContentPane().add('West',button) frame.pack() ---------------------------------------------------------------------------- -------------------------- |
From: D-Man <ds...@ri...> - 2001-02-22 03:36:43
|
You created a /new/ JFrame instead of using the frame the applet gives you. JFrame, JDialog, JWindow (and maybe one other widget) all have heavyweight native peers. If you create one, you get a new native window. Instead try using the frame the applet already has. (I'm not sure where to find it, but try the Applet class's documentation) -D On Thu, Feb 22, 2001 at 11:46:29AM +0900, syKim wrote: | | however, when I executed it opens another applet window under appletviewer | or netscape.. | | main applet window in appletviewer or netscape is just empty. | | frame=JFrame('test',visible=1,size=(400,300)) ^^^^^^ |
From: William D. <wdd...@ma...> - 2001-03-08 14:19:02
|
Hi, I've been working on a project that I want to distribute as open source and, now that I am about to the alpha stage, I am trying to determine how to do that. I am sure that there is ample guidance at the Sun and Python/Jython websites about the legal aspects, but I am a bit stymied at the technical ones. The source (right now) is all Jython; my long-range plan is to port most of the code to Java and just leave the highest-level stuff in Jython and use Jython for a macro/scripting language for the app. I have done most of the development on a Windoze 2000 laptop (I work on this while I am commuting to work on a train) but, though I want the final product to be as platform-independent as possible, my main user base will be Mac users. My first guess at the easiest way to distribute this code was to use jythonc to build a single jar that would hold all the Jython classes. That way the users would only have to install a jre and Swing. However, I have not had any success in getting jythonc (I get a very long list of compiler errors) to complete this task and the documentation for it seems to be useful more as a reference for experienced users than a tutorial for new ones. It would be helpful to me if someone would post a detailed how-to for the complete task of using jythonc to prepare a jar suitable for distribution to users that will not have Jython installed. If I don't use jythonc, what other ways do you all find to work well? Can I take the .class files built by Jython and use another tool (like ClassWrangler on the Mac) to build a jar that I could distribute with jython.jar? Thanks! Bill |
From: D-Man <ds...@ri...> - 2001-03-08 15:08:07
|
On Thu, Mar 08, 2001 at 08:18:37AM -0600, William Dozier wrote: | My first guess at the easiest way to distribute this code was to use jythonc | to build a single jar that would hold all the Jython classes. That way the | users would only have to install a jre and Swing. However, I have not had I think that this would be the easiest way. | any success in getting jythonc (I get a very long list of compiler errors) | to complete this task and the documentation for it seems to be useful more | as a reference for experienced users than a tutorial for new ones. It would | be helpful to me if someone would post a detailed how-to for the complete | task of using jythonc to prepare a jar suitable for distribution to users | that will not have Jython installed. Hmm, when I tried jythonc I had no trouble at all. I simply gave it the --jar and --deep (or --all) options and it built a jar file containing java bytecodes for my python source and the jython interpreter bundled together. Could you post the errors you are getting? | If I don't use jythonc, what other ways do you all find to work well? Can I | take the .class files built by Jython and use another tool (like | ClassWrangler on the Mac) to build a jar that I could distribute with | jython.jar? AFAIK jythonc merely takes the .class files it outputs and the .class files necessary from the jython.jar file and puts it into a new jar file. (Ok, a simplification since it first generates Java source and also figures out dependencies) If you want to do that by hand, the 'jar' part of the JDK should be able to handle it. jar is run very similarly to tar except it produces a .jar file instead of a .tar file. HTH, -D |