I have done something similar I my plugin to integrate Jython into jEdit. You can find it at
It is not exactly a frame but you have a field where you can type methods which are passed to the interpreter and displayed on a TextComponent.
From: Dave Crane [mailto:email@example.com]
Sent: 29 June 2001 11:45
Subject: [Jython-users] console in a gui
I've wondered about doing this myself, not yet sat down and coded it though. The main work would be in low-level keystroke handling - collect all input characters until [enter] is pressed, then send them to the interpreter. Beyond that, it should be possible to pipe them down to the existing InteractiveConsole code. I've poked about in the internals of that, and successfully subclassed it so that it stores all the stuff from an interactive session as a file which can then be replayed/edited etc. It wasn't too hard - I'm happy to share the source if you think it would help you.
Re piping, I don't think the current code has reconfigurable input/output streams, but it's possible to redirect system.in & .out as long as they aren't needed for another purpose. Might be nicer to alter the interpreter to have configurable streams, but might be a bit of work (don't know, maybe it wouldn't?)!
Would it be cleaner to implement the class as a keylistener rather than a specific GUI frame e.g. JFrame. Not everybody uses Swing, might be nice to have a listener we could plug in and out of any text component? Again, just a thought.
If you do get down to coding this in earnest, give me a shout and I'll see if I'm not too busy to lend a hand.
> Hi all,
> I am wondering if anybody has already tried to build a jython console
> inside a JFrame. I had a look at jython.java in oder to understand how
> input & output of an interactive ssession is handled but couldn't cope
> with it :-(
> Any ideas/suggestions is welcome
Get your free email from www.linuxmail.org
Powered by Outblaze
Jython-users mailing list