Two KeyBindings for one Action
From: harald ebert (harald.ebert_at_web.de)
Date: 04/26/04
- Next message: Laird Nelson: "Re: MVC pattern"
- Previous message: Kiet: "how to make data frequency update and display on GUI"
- Next in thread: ak: "Re: Two KeyBindings for one Action"
- Reply: ak: "Re: Two KeyBindings for one Action"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Apr 2004 07:00:52 -0700
Hello,
I want an Action to have 2 KeyBindings.
First the minus sign from the KeyPad,
second the minus sign from the NumPad.
public class MyAction extends AbstractAction {
public MyAction() {
super(parent, "MyAction");
putValue(ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_MINUS,
InputEvent.CTRL_MASK));
}
public void actionPerformed(java.awt.event.ActionEvent e) { }
}
I looked at the code of AbstractAction and the design of the Actions
property table allows, as far as I can see, only one accelerator key,
i.e. setting a second KeyStroke replaces the previously set one.
Does anybody know whether it is possible to have two KeyStrokes for on
Action?
Where can I find some information on how to?
Or do I have to use other mechanisms to get this to work?
Thanks for your help
Harald Ebert
- Next message: Laird Nelson: "Re: MVC pattern"
- Previous message: Kiet: "how to make data frequency update and display on GUI"
- Next in thread: ak: "Re: Two KeyBindings for one Action"
- Reply: ak: "Re: Two KeyBindings for one Action"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]