Hi Stuart,

In Swing, Accelerator can only be set on JMenuItem and not on JMenu or
JButton etc.

So the IAction.ACCELERATOR_KEY property of Action will be used by only those
components which allow setAccelerator.

ULC's behavior is that provided by Swing.

The ToolTip text (i.e. whether to show acceleartor key on tooltip in
addition to the message) is determined by the LookAndFeel class such as
MetalToolTipUI etc.

Thanks and regards,

Janak

>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of Stuart Booth
>Sent: Tuesday, August 15, 2006 8:04 PM
>To: [email protected]
>Subject: [ULC-developer] Bug using Actions ?
>
>
>When using actions, I find that the accelerator key is shown
>differently in
>a menu than it is in a toolbar. For example, using the code below the menu
>item correctly shows "F9", as does it's tooltip, but a button on a toolbar
>shows "Alt-R" as its tooltip. Interestingly, this new key also works to
>activate the action.
>
>    private final class RunAction extends AbstractAction {
>
>        public RunAction() {
>            super();
>
>            putValue(IAction.NAME, "Run");
>            putValue(IAction.SHORT_DESCRIPTION, "Run the current project");
>            putValue(IAction.MNEMONIC_KEY, new Integer('R'));
>            putValue(IAction.ACCELERATOR_KEY,
>KeyStroke.getKeyStroke("F9"));
>            ULCIcon icon = new
>ULCIcon(getClass().getResource("/images/run.png"));
>            putValue(IAction.SMALL_ICON, icon);
>        }
>
>        public void actionPerformed(ActionEvent actionEvent) {
>            // my stuff...
>        }
>    }
>
>In other cases, I don't set the IAction.ACCELERATOR_KEY, but the
>tooltips on
>the buttons are set to varous values such as "Alt-NumPad ." I noticed that
>if I don't set the IAction.MNEMONIC_KEY, I get different results.
>
>I tested this on 6.1 and also just on 6.1.1 using Windows XP.
>
>Thanks for any insight you can give.
>
>-Stuart Booth (Abacus Research)
>
>_______________________________________________
>ULC-developer mailing list
>[email protected]
>http://lists.canoo.com/mailman/listinfo/ulc-developer

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to