key-bindings

Why does the keylistener stop working?

大憨熊 提交于 2019-12-24 01:04:45
问题 In my Java program, whenever I select some text from a JTextField, the keyListener stops detecting key presses. I noticed the same thing happens when a JButton is pressed. Do I need to remove the keyListener from the objects after using them? If so, how to I do this? Here is a copy of the program I'm having problems with: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ColourDropper extends JPanel implements KeyListener, ActionListener { private Color background

Disabling global KeyBindings in some controls in wpf c#

爱⌒轻易说出口 提交于 2019-12-23 19:11:04
问题 I have a main window with some keybindings like this: <Window.InputBindings> <KeyBinding Command="{Binding RotateCommand}" CommandParameter="left" Key="L"> </KeyBinding> <KeyBinding Command="{Binding RotateCommand}" CommandParameter="right" Key="R" /> </Window.InputBindings> The problem is that I am unable to type this letters in any textboxes in that window, keys L and R just call commands. Is there any way to disable KeyBindings inside of some controls? (Maybe when some controls have a

JTextPane: KeyBindings are not working on StyledEditorKit

半世苍凉 提交于 2019-12-23 18:06:05
问题 Please have a look at the following code import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.text.*; public class Form1 extends JFrame { private JTextPane textPane; private JPanel south; private JScrollPane

JButton & Action & KeyBinding

时光怂恿深爱的人放手 提交于 2019-12-23 17:23:28
问题 I have created a JButton class that recieving Action, the JButton class includes keystrokes & mouse listener so i can use the same class in multiple frames as needed. My problems is that: JButton not getting the focus when pressing the key, but it doing the action. i need to make a new background or something that tell the user that the button did the action. Any ideas?? Here is my code: import java.awt.Color; import java.awt.Dimension; import java.awt.Insets; import java.awt.event.KeyEvent;

Custom Keybindings for Ipython terminal

ⅰ亾dé卋堺 提交于 2019-12-23 15:53:19
问题 Is it possible to define custom keybindings and/or desactivate the default ones for Ipython terminal interface? For example, I have bound C + j and C + l to move left and right in my terminal by configuring the ~/.inputrc file (Linux), but when using Ipython terminal, C + l is captured before and actually clears the screen. So my questions are: 1) Is it possible to desactivate some keybindings of Ipython 2) Even better, is it possible to totally configure Ipython keymap? 回答1: Reposting as an

Default button input map in a synth look and feel?

馋奶兔 提交于 2019-12-23 12:27:10
问题 I am trying to use the UIManager to get and clear some default key bindings so that the spacebar doesn't activate my JButtons, as explained here. Problem is, likely due to my synth look and feel, (InputMap)UIManager.get("Button.focusInputMap"); returns a null . Does anyone know of a way to easily clear components input maps some other way, or why the UIManager returns a null in this case? Any tips are appreciated, thanks beforehand. 回答1: I'm not near a computer to try this, but looking at the

Super key binding in emacs

旧街凉风 提交于 2019-12-23 07:58:02
问题 (global-set-key (kbd "<s-d>") 'duplicate-line) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECB MODE;;;;;;;;;;;;;;;;;;;;; (global-set-key (kbd "<s-left>") 'ecb-goto-window-methods) (global-set-key (kbd "<s-right>") 'ecb-goto-window-edit1) (global-set-key (kbd "<s-down>") 'ecb-goto-window-history) (global-set-key (kbd "<s-up>") 'ecb-goto-window-sources) (global-set-key (kbd "<s-home>") 'ecb-goto-window-directories) This is part of my .emacs file. I am facing a strange problem while binding a

Way to Create Keyboard Shortcuts for Google Search Results? [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 06:13:36
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I was wondering if anybody knows a way to create keyboard shortcuts for google search results. For instance, I'm looking for a way open up the first google search result with the number 1, on my keyboard, and for each successive entry to be opened with the next number. I've

which component handles arrow KeyEvents when JTextPane is embedded in JScrollPane?

北城以北 提交于 2019-12-23 04:47:16
问题 OK here we go again. Steve has to program another non-standard set of key strokes. We have an editable JTextPane embedded in a JScrollPane. This pane correctly handles the Up and Down arrow keys, but I can't figure out how. If I could figure out how, I could implement the nonstandard things I need to implement. Specifically, because the PageDown key is globally mapped to doing another function we don't do the default actions for PageUp, PageDown,Ctrl-PageUp and Ctrl-PageDown. Instead we want

emacs keybinding doesn't work in terminal

雨燕双飞 提交于 2019-12-23 02:55:19
问题 I've set the following key bindings in my .emacs file: (global-set-key (kbd "C-S-M-w") 'windmove-up) (global-set-key (kbd "C-S-M-s") 'windmove-down) (global-set-key (kbd "C-S-M-d") 'windmove-right) (global-set-key (kbd "C-S-M-a") 'windmove-left) (global-set-key (kbd "C-S-a") 'shrink-window-horizontally) (global-set-key (kbd "C-S-d") 'enlarge-window-horizontally) (global-set-key (kbd "C-S-s") 'shrink-window) (global-set-key (kbd "C-S-w") 'enlarge-window) They work just fine when they're in