472,796 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

Jython/Python and javax.swing.*

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?

Jul 18 '05 #1
3 4795
Sherrod Faulks <bi****@verizon.net> wrote in message news:<2004082212534416807%birded@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
Jul 18 '05 #2
Sherrod Faulks <bi****@verizon.net> wrote in message news:<2004082212534416807%birded@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,

Having had a look at my last post after a nights sleep I'm not sure it
was very clear...

If you change your script to the following it should work:

import javax.swing as swing
result = swing.JOptionPane.showInputDialog(wC, cmd[8:],"Promptfrom " +
client.serverName, swing.JOptionPane.PLAIN_MESSAGE)

Cheers,

John
Jul 18 '05 #3
John,
Sorry I didn't reply earlier, but I found out how to do it in the
Jython Doc. You must do:

from pawt import swing

Thanks for helping, though!

On 2004-08-23 07:03:12 -0400, cr*********@btinternet.com (John Crichton) said:
Sherrod Faulks <bi****@verizon.net> wrote in message
news:<2004082212534416807%birded@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,

Having had a look at my last post after a nights sleep I'm not sure it
was very clear...

If you change your script to the following it should work:

import javax.swing as swing
result = swing.JOptionPane.showInputDialog(wC, cmd[8:],"Promptfrom " +
client.serverName, swing.JOptionPane.PLAIN_MESSAGE)

Cheers,

John

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Asad Khan | last post by:
Hi, I am using DrJava, and I am writing a program that has the following statement: import javax.swing; It gives me this error when compiled: File: C:\Program...
0
by: Matt Newcomb | last post by:
G'day, Hi. I'm new to jython/python and am trying to interface a jython script with some java code that produces property change events. Here's the jython code: import sys; from javax...
0
by: Sherrod Faulks | last post by:
I'm using Jython and in the python script I do: from javax import swing result = javax.swing.JOptionPane.showInputDialog(wC, cmd,"Prompt from " + client.serverName, JOptionPane.PLAIN_MESSAGE) ...
1
by: Nandan | last post by:
hello, can I ask a jython question here? when I use the jython interpreter I have no problem with the statement: from java import lang from javax import swing but when I put this in a...
6
by: Mike Wimpe | last post by:
Other than being used to wrap Java classes, what other real use is there for Jython being that Python has many other GUI toolkits available? Also, these toolkits like Tkinter are so much better for...
4
by: Nadeem Mohsin | last post by:
Me and a couple of friends have been thinking of doing something involving Python for our final year undergrad project. We're considering the first idea mentioned on this page:...
2
by: donkeyboy | last post by:
All, I've tried the jythonc compiler to try and create an applet to see how it works, but I get a number of Java compile errors that are way above my knowledge. Does anyone know what any of the...
8
oll3i
by: oll3i | last post by:
it worked but suddenly when i run it and click a button it throws exception ? D:\SR>java Producent queue1 queue2 queue3 queue4 queue1,queue2,queue3,queue4...
5
by: sarup26 | last post by:
Hello .. I would like to know more about Python and Jython? What is the difference between both of them? What is the future for Jython and which are the areas where it is used? Swot
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.