key-bindings

Full screen Window won't get keyboard input using KeyListener or KeyBoardFocusManager

主宰稳场 提交于 2019-12-01 15:31:08
问题 I'm having problems with getting my KeyBoardFocusManger to work with my full screen Window . No matter what, it just wont get keyboard input. I used a System.exit(0) and a println() to look for any call to the keypressed/released/typed method, but no errors are thrown. I've tried KeyListeners ; but after I read this, I changed to a KeyboardFocusManager , and the same thing still happens. I'm really getting desperate; from what I can judge, the Window is not getting focus of the keyboard? Here

How to set a Single key Mnemonic in button in Java?

こ雲淡風輕ζ 提交于 2019-12-01 14:36:41
问题 I am working on a project and I want to set Mnemonic on buttons. But the problem is Mnemonic works on pairing key example ( Alt + F ) etc. But I want it to be on single key. 回答1: have look at KeyBindings, then you can to attach any Key to the JButton Here is one example code for your help, just Press C on the Keyboard : import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.Action; public class ButtonExample { private JFrame frame; private JButton button; private

Programmatically enable editing a JTable cell on keystroke

时光毁灭记忆、已成空白 提交于 2019-12-01 13:47:33
I would like to enable editing a JTable cell on a key, say F2. I know that by default double clicking will enable editing, but is there a way to bind that event to a key? I tried this link JTable edit on keypress but it doesn't work for me. Here is my code: public class DatabaseJTable extends JTable implements MouseListener { public DatabaseJTable(Object [][] data, Object [] columnNames) { super(data, columnNames); InputMap inputMap = this.getInputMap(JComponent.WHEN_FOCUSED); ActionMap actionMap = this.getActionMap(); this.addMouseListener(this); // bind edit record to F2 key inputMap.put

BUG: Java Swing Key Bindings Lose Function with JDK 7 in OSX with awt setFullScreenWindow

ε祈祈猫儿з 提交于 2019-12-01 13:12:19
EDIT 1/16/2013: The original question has been deleted. This seems to be a bug with the JDK 7 on mac OSX. I have filed a bug report with Sun (Oracle). The file below uses the awt class GraphicsEnvironment and the method setFullScreenWindow to display an image to fullscreen. No images are included, so the screen will be gray when running the code. The key bindings should, however, still work. There are two key bindings. Pressing 'ENTER' should print "Enter was pressed." to stdout. Pressing 'ESCAPE' should print "Program Terminated by ESC Key" to stdout and quit the program. Using Windows 7 64

Emacs key bindings change in terminal emulator

末鹿安然 提交于 2019-12-01 11:02:47
I notice that some Emacs key bindings change in terminal emulator ( xfce4-terminal ). For example: M-SPC under TTY sets the mark, but in xfce4-terminal it does nothing. Also: C-- is undo in TTY and does nothing in terminal emulator C-/ is erase char backward in TTY, and undo in terminal emulator Is there any solution to prevent the burden of learning two rules? I just want them as usual in TTY console. Dan It's not an Emacs problem so much as a terminal problem. Terminal emulators can be limited in the control and escape sequences they can send, so it's probably the case that the emulators you

How do I create a keybinding to the backslash key in WPF?

大兔子大兔子 提交于 2019-12-01 09:25:37
Trying to define a CTRL - \ (Backslash) keybinding for our WPF command, but we're running into two issues: There isn't any pre-defined constant for the backslash key, only OemBackslash, and There doesn't seem to be a consistent numeric code for OemBackslash either For instance, a Dell returns a different value for e.Key if you're on a Dell vs. if you're booted into Windows on a Mac. Yet both do correctly type a backslash. The thing that frustrates me is rather than going on what those codes map to in the driver--i.e. what's actually on the key face--MS based their keyboard shortcuts on the key

do something once the key is held and repeat when its released and repressed

二次信任 提交于 2019-12-01 09:08:56
I need to check when the user presses on a key and releases it. If a key is held in, I will do something once. I used the keystroke to get the button I want to relate an action with. I used also a semaphore to overcome this problem but it looks crazy My code: ` InputMap inputMap = jPanel1.getInputMap(); KeyStroke keyPressed = KeyStroke.getKeyStroke(KeyEvent.VK_1, 0, false); KeyStroke keyReleased = KeyStroke.getKeyStroke(KeyEvent.VK_1, 0, true); //------------------------------------------ jPanel1.getActionMap().put("_1000Press", _1000Press); inputMap.put(keyPressed, "_1000Press"); jPanel1

Key bindings in Xcode 5

瘦欲@ 提交于 2019-12-01 08:43:57
I used to do this: Xcode duplicate line But IDETextKeyBindingSet.plist doesn't exist anymore. There is a folder called "KeyBindings" with a blank text file in it. So how do we set up key bindings now? Specifically I just want command-D to duplicate the line the cursor is in, which is a basic functionality of every other IDE except Xcode. The KeyBindings directory stores just per-user key bindings for already available operations in Xcode. On the other hand, the IDETextKeyBindingSet.plist lets you add an operation to Xcode itself (and afterwards put a key binding into your KeyBindings dir).

How to set on key press key binding?

不羁岁月 提交于 2019-12-01 07:47:09
问题 The arrow keys for this application need to cause press and release events independent of focus. Setting onKeyRelease true causes a release event as expected but setting onKeyRelease false (code below) doesn't seem to stop auto-repeat. Is there a way to implement the key binding to trigger once when the arrow key is pressed and held? Action right = new AbstractAction() { public void actionPerformed(ActionEvent e) { ... } }; mainPanel.getInputMap(JPanel.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put

How do I create a keybinding to the backslash key in WPF?

雨燕双飞 提交于 2019-12-01 07:07:48
问题 Trying to define a CTRL - \ (Backslash) keybinding for our WPF command, but we're running into two issues: There isn't any pre-defined constant for the backslash key, only OemBackslash, and There doesn't seem to be a consistent numeric code for OemBackslash either For instance, a Dell returns a different value for e.Key if you're on a Dell vs. if you're booted into Windows on a Mac. Yet both do correctly type a backslash. The thing that frustrates me is rather than going on what those codes