HELP NEEDED........PLZ
I know how to set accelerator for a JMenuItem but how can I set accelerator with bothControl button and[Shift button.
I mean
SaveAs...Ctrl+Shift+S
how can I set accelerator like this?
I know how to set accelerator for a JMenuItem but how can I set accelerator with bothControl button and[Shift button.
I mean
SaveAs...Ctrl+Shift+S
how can I set accelerator like this?
1) Your subject line is uninformative (minus 2 points)
2) Your subject line is ALL IN CAPS (minus 10 points)
3) Your subject line contains "........" (minus 7 points)
4) You subject line contains PLZ (minus 5 points)
5) This is a Swing question incorrectly posted into a forum other then the Swing forum (minus 10 points)
So I give this post a score of negative 34 plus 5 dukes gives us a balance of negative 29.
So you fail.
how to that?
I mean I tried
saveFileAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,KeyEvent.CTRL_MASK && KeyEvent.SHIFT_MASK));
but this dose not work.
From the API for KeyStroke
getKeyStroke
public static KeyStroke getKeyStroke(Character keyChar,
int modifiers)
Returns a shared instance of a KeyStroke, given a Character object and a set of modifiers. Note that the first parameter is of type Character rather than char. This is to avoid inadvertent clashes with calls to getKeyStroke(int keyCode, int modifiers). The modifiers consist of any combination of:
java.awt.event.InputEvent.SHIFT_MASK (1)
java.awt.event.InputEvent.CTRL_MASK (2)
java.awt.event.InputEvent.META_MASK (4)
java.awt.event.InputEvent.ALT_MASK (8)
Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers.
Parameters:
keyChar - the Character object for a keyboard character
modifiers - a bitwise-ored combination of any modifiers
Returns:
an KeyStroke object for that key
Throws:
IllegalArgumentException - if keyChar is null
Since:
1.3
See Also:
InputEvent
something like this?:
yourJMenuItem.setAccelerator(KeyStroke.getKeyStroke(VK_S, SHIFT_DOWN_MASK | CTRL_DOWN_MASK));
Message was edited by:
petes1234
KeyStroke.getKeyStroke(KeyEvent.VK_S,ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)
Message was edited by:
Yannix