473,698 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Jython/Python and javax.swing.*

I'm using Jython and in the python script I do:

from javax import swing
result = javax.swing.JOp tionPane.showIn putDialog(wC, cmd[8:],"Prompt
from " + client.serverNa me, JOptionPane.PLA IN_MESSAGE)

wC is a JFrame, cmd is a String and client.serverNa me is a String.
It won't show the JOptionPane, why?

Jul 18 '05 #1
3 4860
Sherrod Faulks <bi****@verizon .net> wrote in message news:<200408221 2534416807%bird ed@verizonnet>. ..
I'm using Jython and in the python script I do:

from javax import swing
result = javax.swing.JOp tionPane.showIn putDialog(wC, cmd[8:],"Prompt
from " + client.serverNa me, JOptionPane.PLA IN_MESSAGE)

wC is a JFrame, cmd is a String and client.serverNa me 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.serverN ame' to 'client_serverN ame' to make my script work -
but this is only cosmetic and 'client.serverN ame' will work fine in
your script assuming
it resolves to a string.)

import javax.swing.JOp tionPane as JOptionPane
import javax.swing.JFr ame as JFrame
wC = JFrame('jython' )
cmd = 'JythonJython'
client_serverNa me = 'name'
result = JOptionPane.sho wInputDialog(wC , cmd[8:],"Prompt from " +
client_serverNa me, JOptionPane.PLA IN_MESSAGE)

Best wishes,

John
Jul 18 '05 #2
Sherrod Faulks <bi****@verizon .net> wrote in message news:<200408221 2534416807%bird ed@verizonnet>. ..
I'm using Jython and in the python script I do:

from javax import swing
result = javax.swing.JOp tionPane.showIn putDialog(wC, cmd[8:],"Prompt
from " + client.serverNa me, JOptionPane.PLA IN_MESSAGE)

wC is a JFrame, cmd is a String and client.serverNa me 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.JOptionPa ne.showInputDia log(wC, cmd[8:],"Promptfrom " +
client.serverNa me, swing.JOptionPa ne.PLAIN_MESSAG E)

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*********@bti nternet.com (John Crichton) said:
Sherrod Faulks <bi****@verizon .net> wrote in message
news:<200408221 2534416807%bird ed@verizonnet>. ..
I'm using Jython and in the python script I do:

from javax import swing
result = javax.swing.JOp tionPane.showIn putDialog(wC, cmd[8:],"Prompt
from " + client.serverNa me, JOptionPane.PLA IN_MESSAGE)

wC is a JFrame, cmd is a String and client.serverNa me 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.JOptionPa ne.showInputDia log(wC, cmd[8:],"Promptfrom " +
client.serverNa me, swing.JOptionPa ne.PLAIN_MESSAG E)

Cheers,

John

Jul 18 '05 #4

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

Similar topics

5
14712
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 Files\DrJava\CustomJFrame.java
0
1442
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 import swing; from java.beans import PropertyChangeListener; from gov.nasa.gsfc.irc.instrument import InstrumentModelProvider;
0
1221
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) wC is a JFrame, cmd is a String and client.serverName is a String. It won't show the JOptionPane, why?
1
2235
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 script, I get a package not found error. what am I doing wrong?
6
2822
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 client usage (and faster) than Swing, so what would be the advantage for using Jython? or Is Jython really just so that Java developers can write Java code faster? Mike Wimpe
4
3627
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: http://wiki.python.org/moin/JythonProjects. Unfortunately, their statement is a little terse, so I was hoping someone could give us a better idea of what they wanted. As far as I can see, they want us to build an integrated development environment for Jython...
2
2471
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 following means? I'm using JDK 1.5.0_09, under Win XP SP2. Runnnig the file " jython FILENAME" works, so I don't know what's happening. Any thoughts?
8
6158
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 javax.naming.NoInitialContextException: Cannot instantiate class: org.exolab.jms .jndi.InitialContextFactory at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6 57) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288 )
5
3604
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
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.