1

I am emulating an Arabic keyboard and why they use the Tilde key for an alphabet, I don't know. Regardless, I have to make it work.

I am using the following key binding code to grab the ~ key, but it doesn't seem to register:

JButton key = new JButton();
key.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(DEAD_TILDE, "action");
key.getActionMap().put("action", new KeyAction(key));

I have looked online and can't find an explanation for this.

Can anybody please help me out?

6
  • depends of is is used with InputEvent.SHIFT_DOWN_MASK or not
    – mKorbel
    Mar 1, 2015 at 6:20
  • I am not sure I get what you mean.
    – Omar
    Mar 1, 2015 at 7:10
  • I'm (from my Slovak keyboard) using SHIFT(isDown()) + VK_DEAD_TILDE
    – mKorbel
    Mar 1, 2015 at 7:22
  • I see. Is there anyway to use the VK_DEAD_TILDE by itself?
    – Omar
    Mar 1, 2015 at 7:26
  • 1
    you have to combine modifiers (SHIFT/CTRL/ALT) with KeyEvents if is used, otherwise, good one inMap.put(KeyStroke.getKeyStroke(key, InputEvent.SHIFT_DOWN_MASK), name); by @Hovercraft Full Of Eels (as always)
    – mKorbel
    Mar 1, 2015 at 7:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.