From: Ted B. <te...@et...> - 2001-09-11 00:39:46
|
On Monday 10 September 2001 09:17, Richard Cook wrote: > if I write (in tst.py) > > from javax.swing import * > b=JLabel("bob", displayedMnemonic=66) > > jython tst.py gives: > > Traceback (innermost last): > File "tst.py", line 2, in ? > AttributeError: read-only attr: displayedMnemonic > > If I have this: > > from javax.swing import * > > class Dummy(JPanel): > pass > > b=JLabel("bob", displayedMnemonic=66) > > Then I get no complaint. Am I doing something wrong? > > Also, because displayedMnemonic is an int property, > > b=JLabel("bob", displayedMnemonic='b') > fails (can't convert string to int) > > but > b.setDisplayedMnemonic('b') works OK because presumably it calls > setDisplayedMnemonic(char) > > Is there a way to set displayedMnemonic in the constructor more naturally? > b = JLabel( "bob", displayedMnemonic=ord( 'b' ) ) ted |