key-bindings

Java KeyEvent square movement

冷暖自知 提交于 2019-11-27 19:40:07
问题 I have a piece of code in which a KeyEvent is triggered when any of the arrow keys are pressed. This in turn causes a square to move across the screen. Now I've noticed that when I press and hold the key, the square moves but the time after the initial movement to the subsequent movements is quite long if you understand what I mean? How would I go about diminishing this time? Thanks! import java.awt.*; import javax.swing.*; import squarequest.sprites.*; import java.awt.event.*; public class

How can I listen for keypress event on the whole page?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 17:19:28
I'm looking for a way to bind a function to my whole page (when a user presses a key, I want it to trigger a function in my component.ts) It was easy in AngularJS with a ng-keypress but it does not work with (keypress)="handleInput($event)" . I tried it with a div wrapper on the whole page but it doesn't seem to work. it only works when the focus is on it. <div (keypress)="handleInput($event)" tabindex="1"> I would use @HostListener decorator within your component: import { HostListener } from '@angular/core'; @Component({ ... }) export class AppComponent { @HostListener('document:keypress', [

Emacs Keybindings in Visual Studio 2012 or 2013

别等时光非礼了梦想. 提交于 2019-11-27 17:14:42
I would prefer to have Emacs keybindings in MSVS. In MSVS 2008, this was natively supported, and in MSVS2010 there was an extension to achieve this http://blogs.msdn.com/b/visualstudio/archive/2010/09/01/emacs-emulation-extension-now-available.aspx Can i install this extension in MSVS 2012? (I have thus far been unsuccessful...) Is there another way to achieve Emacs keybindings? I figured out how to get the emacs emulation extension for VS 2010 to install and run on VS 2012. This is a bit from memory, but here is what I did. Download the Emacs emulation extension . Rename it from

JavaFX: scrolling vs. focus traversal with arrow keys

余生颓废 提交于 2019-11-27 16:44:10
问题 I got a ScrollPane containing focusable Nodes. The current default behaviour is: Shift + ← , ↑ , → , ↓ moves the focus ← , ↑ , → , ↓ scrolls the view I want it the other way around. How can I accomplish this or where should I start? [EDIT] Well, there is another fragile approach. Instead of messing around with the events, one could mess around with the KeyBinding s. scrollPane.skinProperty().addListener(new ChangeListener<Skin<?>>() { @Override public void changed(ObservableValue<? extends

Keybinding a RelayCommand

六眼飞鱼酱① 提交于 2019-11-27 14:35:36
I'm using the RelayCommand in my app. It's great for putting the code in the viewmodel, but how do I bind keystrokes to my command? RoutedUICommand has its InputGestures property, which makes the command automatically be invoked when I press the keystroke. (As an added bonus, it even makes the keystroke display in the MenuItem.) Unfortunately, there's no reusable interface for RoutedUICommand's extra properties, so I can't make a RelayUICommand that gets the same magic. I've already tried using InputBindings: <Window.InputBindings> <KeyBinding Key="PageUp" Command="{Binding

List all Keybindings for a certain emacs mode

不羁岁月 提交于 2019-11-27 09:59:12
问题 I know that I can list all the keybidings avaliable in emacs by using C-h b, but is it possible to list only the keybindings that apply to a certain mode, say dired-mode. In dired+, I can do ? h and it shows me all the applicable dired mode keybindings. Thanks 回答1: use C-h m or M-x describe-mode 回答2: Not sure what the question is. C-h b shows you all of the key bindings currently available (i.e., in the current mode). If you want to see only the key bindings provided by a mode's own keymap,

Sublime Text: Select all instances of a variable and edit variable name

丶灬走出姿态 提交于 2019-11-27 09:55:36
I'm new to Sublime, and I just discovered that if I select a variable (not just any string) in my code, all other instances of that variable get a stroke (white outline) around them: Is there a keyboard shortcut that will let me select all of those instances of the variable and edit them all at once? Things I've tried: Using ⌘ D , ⌘ K , and ⌘ U lets me select them one-by-one, but I have to manually exclude the non-variable string matches: And using Ctrl ⌘ G simply selects all the string matches: Clearly, Sublime is able to differentiate between variable- and string-matches. Is there no way to

Consume typed key by implements KeyBindings

∥☆過路亽.° 提交于 2019-11-27 07:29:10
问题 Can you please help me how to use KeyBinding and with Consume for typed Chars together, same way as demostraded my SSCCE by using KeyListener import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; public class Login { private static final long serialVersionUID = 1L; /* PassWord for unlock*/ private PswChecker checker = new PswChecker("pass"); public Login() { JTextField firstField = new JTextField(10); firstField.addKeyListener

Certain keybindings don't work when using emacs in a terminal

微笑、不失礼 提交于 2019-11-27 07:02:13
问题 I load GNU emacs in it's own window by typing emacs in the terminal. I like to use the keybindings from pc-selection-mode, which allows you to highlight characters using shift-right or shift-left, or entire lines by pressing shift-up or shift-down. The problem is that when I run emacs in the terminal by typing emacs -nw , the latter 2 keybindings don't work. I can highlight characters using shift-left and shift-right, but pressing shift-up and shift-down doesn't do anything. The cursor stays

How to use TextAction

为君一笑 提交于 2019-11-27 05:36:26
What are the purposes of using TextAction from AbstractAction ? and how to use it for the following: Caret Selection in the JTextComponents KeyBindings trashgod While composing this answer , I recalled a venerable HTMLDocumentEditor by Charles Bell that illustrates the typical usage of the subclasses found in javax.swing.text.TextAction . That editor is listed among the credits of Metaphase Editor . This related example showing actions found in StyledEditorKit follows the same approach. All such actions are suitable for Key Bindings , and all operate on the current selection maintained by the