commons-user mailing list archives

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

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:

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

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?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message