key-bindings

Programmatically enable editing a JTable cell on keystroke

十年热恋 提交于 2019-12-19 11:51:24
问题 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

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

六月ゝ 毕业季﹏ 提交于 2019-12-19 11:29:44
问题 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

Emacs key bindings change in terminal emulator

喜欢而已 提交于 2019-12-19 10:24:44
问题 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. 回答1: It's not an Emacs problem so much as a terminal problem. Terminal emulators can be

KeyBinding on a TreeViewItem

落花浮王杯 提交于 2019-12-19 06:08:04
问题 I have a typical treeview and a viewmodel. The viewmodel has an observable collection of other viewmodels that serves as a data source for the tree. public class TreeViewVM { public ObservableCollection<ItemVM> Items { get; private set; } public ItemVM SelectedItem { get; set; } } and the ItemVM : public class ItemVM { public string Name { get; set; } public ImageSource Image { get; private set; } public ObservableCollection<ItemVM> Children { get; private set; } public ICommand Rename { get;

Make Vim use Dvorak keybindings ONLY in insert mode?

允我心安 提交于 2019-12-19 05:48:20
问题 I would like to use the Dvorak layout when I am typing in Vim. However, I would like all of my shortcuts to stay the same (behave as if keyboard is Qwerty in command mode). I have tried using this: set langmap=q',e.,rp,ty,yf,ug,ic,or,pl,[/,]=,aa,so,de,fu,gi,hd,jh,kt,ln,\\;s,'-,z\\;,xq,cj,vk,bx,nb,mm,.v,/z,-[,=],Q\\",W<,E>,RP,TY,YF,UG,IC,OR,PL,{?,}+,AA,SO,DE,FU,GI,HD,JH,KT,LN,:S,"_,Z:,XQ,CJ,VK,BX,NB,MM,<W,>V,?Z to map my qwerty keys to dvorak while in insert mode, but I found that it

KeyPressed event in java

落花浮王杯 提交于 2019-12-19 03:24:34
问题 I have just created a java tic-tac-toe game i would like to figure out how to run a method once the enter key is pressed during a certain condition an example is below... if(/*condition is met*/){ //keyListener } 回答1: Depending on where you want to trap the "enter" key, you could use an ActionListener (on such components such as text components or buttons) or attach a key binding to you component public class MyPanel extends JPanel { public MyPanel() { InputMap im = getInputMap(WHEN_FOCUSED);

File-specific key-binding in emacs

不打扰是莪最后的温柔 提交于 2019-12-18 08:58:13
问题 Is it possible to define file specific key-bindings in emacs? I suppose it would be possible to create a minor mode and have it loaded when the particular file is open but for only one key-binding that seems overkill. 回答1: If you combine the code to local-set-key and Buffer-locally overriding minor-mode key bindings in Emacs then you could end up with something like this: (defun my-buffer-local-set-key (key command) (interactive "KSet key buffer-locally: \nCSet key %s buffer-locally to

How can i make multiple Key Bindings work at the same time?

天大地大妈咪最大 提交于 2019-12-18 05:25:09
问题 I need to design a game with two players. Each has a ball and should be able to move the ball to right or left, the first player with 'a' 'd' buttons and the second player with right,left arrow buttons. However currently one player needs to wait for the other player's action to be completed in order to move their own ball. How can i resolve that problem? Here is the related parts of my code: public class AnimationWindow extends JPanel{ public AnimationWindow() { super(); .... .... cezmiMover(

Java Keybinding Plus Key

狂风中的少年 提交于 2019-12-18 04:15:13
问题 I was trying to create shortcuts for zooming in and out in an image editing application I'm creating and I noticed something strange. To bind the combination of ctrl + + , I had to use the = key and a control and shift mask: getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK),"ZoomIn"); Neither of the combinations where I tried to directly bind to VK_PLUS worked: getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, KeyEvent

How to capture Ctrl + Tab and Ctrl + Shift + Tab in WPF?

若如初见. 提交于 2019-12-17 21:43:42
问题 What would be some sample code that will trap the Ctrl + Tab and Ctrl + Shift + Tab for a WPF application? We have created KeyDown events and also tried adding command bindings with input gestures, but we were never able to trap these two shortcuts. 回答1: What KeyDown handler did you have? The code below works for me. The one that gives me trouble is: Alt + Tab , but you didn't ask for that :D public Window1() { InitializeComponent(); AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler