key-bindings

Type ENTER key is not capture

こ雲淡風輕ζ 提交于 2019-12-11 07:57:56
问题 In my application I have a JTable where I mapped a Key event. The source: getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "selectNextColumnCell"); getActionMap().put("selectNextColumnCell", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //DO SOMETHING } }); } But this action is only called when I press the enter key and don't release it. But I need call this action every time when the user type the

Disabling prefix key binding

你说的曾经没有我的故事 提交于 2019-12-11 07:47:09
问题 In shell mode on emacs, the current key binding for quitting the shell mode ( 'comint-interrupt-subjob ) is "\C-c \C-c" , and I want to change it to "\C-c" as in ordinary linux shell. I tried (add-hook 'shell-mode-hook '(lambda () (local-set-key "\C-c" 'comint-interrupt-subjob) )) But it did not work. Probably I need to disable the prefix assigned to "\C-c" . How can I do that? 回答1: Try this: (eval-after-load "shell" '(define-key shell-mode-map (kbd "C-c") 'comint-interrupt-subjob)) In

Emacs keybinding to comment selection/multiple lines for SQL file?

送分小仙女□ 提交于 2019-12-11 07:15:34
问题 I have a .sql file that I am editing in Emacs 24, and I am looking for a way to comment out a selection or a line. Basically, I want a keybinding to add -- at the line start (for single line comments) or /* and */ around the selected region (for variable line comments). Perhaps there is something that I can add to my .emacs to enable such a keybinding? (I am a bit of a novice to Emacs) Thanks. EDIT After a little exploring, I found M-x comment-region to do the trick for single line comments.

Ace editor, how to remove all keyBindings but one?

妖精的绣舞 提交于 2019-12-11 06:26:52
问题 I recently had a textarea on my jsp page For it, I had my own shortcuts on the keyboard Then, I implemented the ace editor, and all my old keybindings didn't work then Then i searched for a while, and found this code: //I did this before, to add the ace editor var editor = ace.edit("fileInfo"); var JavaScriptMode = ace.require("ace/mode/javascript").Mode; editor.session.setMode(new JavaScriptMode()); //Then I found this for the keyBindings delete editor.keyBinding; The last line, disables all

LeftAlt Keybinding in WPF

倖福魔咒の 提交于 2019-12-11 05:51:52
问题 I'm trying to bind Left ALT key with a command to toggle visibility of a menu in WPF. But it doesn't work.. Command is not firing.. <Window.InputBindings> <KeyBinding Key="LeftAlt" Command="{Binding Path=MenuVisibilitySetCommand}"/> </Window.InputBindings> I've noticed that other special Keys ( such as Alt, Ctrl etc..) also not working here.. How to do KeyBinding for Special Key in WPF ? 回答1: These special Keys are called Modifier keys and this should make it clear why it is not working. A

How do I get a list of all the currently available commands and hotkeys?

最后都变了- 提交于 2019-12-11 05:17:16
问题 To help me learn to work with various emacs modes, I would like to have a second monitor with a little HTML page that is used for showing me what sorts of things I can type or key-chord on whatever I'm currently looking at in emacs. So how can I get a list of all the commands or key-chords available to me in my current mode? 回答1: Someone else will no doubt tell you how to get a cheatsheet such as you request (well, here is info about that too). But if you want something that tells you

Why isn't the keyListener working?

天涯浪子 提交于 2019-12-11 04:33:32
问题 This is a pong game I made, but the only thing that is not working is the paddles moving. I am not sure how to make the keyboard work with the program. Here is the code for the main game: //Project: A program where you play the game pong //This module defines the properties of the user interface import java.awt.*; import javax.swing.*; import java.awt.event.*; public class pongframe extends JFrame { private JLabel playerlefttitle; private JLabel playerrighttitle; private JLabel speedtitle;

Key binding does not work

主宰稳场 提交于 2019-12-11 04:16:49
问题 I have JButton performing some action via ActionListener. After I try to use Action to bind a keyboard shortcut (following this), mouse click on button works, but no reaction to keyboard. Code Before Button created within a panel, actionListener added. private FooActionListener actionListener = new FooActionListener(); buttonLeft = new JButton("Left"); up.addActionListener(actionListener); Then, actionPerformed method within FooActionListener class outside the main class: public void

How to disable CONTROL+PAGE_UP of a JTabbedPane?

六月ゝ 毕业季﹏ 提交于 2019-12-11 04:02:06
问题 How to disable the default behavior of CONTROL+PAGE_UP and CONTROL+PAGE_DOWN of a JTabbedPane ? 回答1: The following code disables the usual behavior JTabbedPane jTabbedPane = new JTabbedPane(); KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl PAGE_DOWN"); KeyStroke ctrlShiftTab = KeyStroke.getKeyStroke("ctrl PAGE_UP"); InputMap inputMap = jTabbedPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(ctrlTab, "none"); inputMap.put(ctrlShiftTab, "none"); Here is an example

Java Key bindings fires both press and release while key is held down

有些话、适合烂在心里 提交于 2019-12-11 03:32:14
问题 So, I made a method that you can pass 2 AbstractAction to, the first one performs the key pressed event and the second performs the key released event. When the I press and release the UP key both actions get fired off, that is fine. If I press and hold the UP key both actions are still fired off. Why are both being fired? Shouldn't only the Key Pressed one be getting fired? Main.java: package sscce; import java.awt.event.ActionEvent; import java.awt.event.KeyAdapter; import javax.swing