commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Beransky <d...@dembel.org>
Subject [digester] setting mnemonic on a jmenu
Date Thu, 27 Oct 2005 20:05:06 GMT
Hi,

I'm using the digester to build a swing menu from an xml descriptor and 
having a hard time getting JMenu.setMnemonic to work.

Here's an XML sample:

<menuBar>
    <menu title="File" hotKey="F"/>
</menuBar>

and Digester rules:

       digester.addObjectCreate("menuBar", JMenuBar.class);
       digester.addObjectCreate("*/menu", "javax.swing.JMenu", "class");
       digester.addSetProperties("*/menu", "title", "text");
       digester.addSetProperties("*/menu", "hotKey", "mnemonic");

       digester.addObjectCreate("*/item", "javax.swing.JMenuItem", "class");
       digester.addSetProperties("*/item", "title", "text");
       digester.addSetProperties("*/item", "enabled", "enabled");
       digester.addSetNext("*/item", "add");

       digester.addObjectCreate("*/item/action", null, "class");
       digester.addSetNext("*/item/action", "setAction");

       digester.addObjectCreate("*/separator", JSeparator.class);
       digester.addSetNext("*/separator", "add");

       digester.addSetNext("*/menu", "add");

when I run the xml through the rules, the mnemonic key doesn't get set. I 
think it has to do with the fact that JMenu has two overlaoded 
setMnemonic() functions: one with an int argument and the other with a char.

What can I do to get the mnemonic key set?


Thanks
Dmitry


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message