jastrachan | 13 Apr 14:13 2004
Picon

Re: Mnemonics in Swing Builder

I think this could be a bug in string-to-char conversions. Right now 
'x' and "x" both equate to a String in Groovy. We don't (yet) support 
Java-style char characters.

I wonder if - as a temporary workaround - you were to use the integer 
version of a mnemonic it might work?

     action(name:'whatever', mnemonic:123)

it might work?

Or another hack...

     action(name:'whatever', mnemonic:'A'.charAt(0))

But yes this sounds like a bug.

On 13 Apr 2004, at 12:43, Kevin Jones wrote:
> I can't get mnemonics to work in SwingBuilder. I have code that is 
> based on
> the unit tests, something like this:
>
> menuBar {
> 	menu(text:'Help', mnemonic:'H') {
> 		menuItem() {
> 			action(name:'About', mnemonic:'A', closure:{
> showAbout() })
> 		}
> 	}
> }
>
> This doesn't work (i.e. the mnemonics aren't set)
>
> If I change the menuItem to this
> menuItem() {
> 	action(name:'About', mnemonic:1, closure:{ showAbout() })
>
> this doesn't work.
>
> If I change the menu to this
> 	menu(text:'Help', mnemonic:1) {
>
> I get an exception: "java.lang.IllegalArgumentException: argument type
> mismatch"
>
> JMenu extends JMenuItem so I should not get an exception (I don't 
> think).
>
> Is this expected? a known issue? or should I raise it as a bug?
>
> Thanks
>
> Kevin Jones
> http://kevinj.develop.com
>
> _______________________________________________
> groovy-dev mailing list
> groovy-dev@...
> http://lists.codehaus.org/mailman/listinfo/groovy-dev
>
>

James
-------
http://radio.weblogs.com/0112098/

Gmane