Jython/Python and javax.swing.*

John Crichton crichton314 at btinternet.com
Sun Aug 22 19:36:38 EDT 2004


Sherrod Faulks <birded at verizon.net> wrote in message news:<2004082212534416807%birded at verizonnet>...
> I'm using Jython and in the python script I do:
> 
> from javax import swing
> result = javax.swing.JOptionPane.showInputDialog(wC, cmd[8:],"Prompt 
> from " + client.serverName, JOptionPane.PLAIN_MESSAGE)
> 
> wC is a JFrame, cmd is a String and client.serverName is a String.
> It won't show the JOptionPane, why?

Hi Sherrod,

Hope this helps. It's a bit longer than your script. (I've also
changed
'client.serverName' to 'client_serverName' to make my script work -
but this is only cosmetic and 'client.serverName' will work fine in
your script assuming
it resolves to a string.)

import javax.swing.JOptionPane as JOptionPane
import javax.swing.JFrame as JFrame
wC = JFrame('jython')
cmd = 'JythonJython'
client_serverName = 'name'
result = JOptionPane.showInputDialog(wC, cmd[8:],"Prompt from " +
client_serverName, JOptionPane.PLAIN_MESSAGE)

Best wishes,

John



More information about the Python-list mailing list