keyevent

JavaFX : How to detect if a key is being held down?

左心房为你撑大大i 提交于 2019-12-10 17:47:34
问题 I'm working with Timelines and was hoping to hook up some KeyPress events to the stage that could alter the way the timeline changes the properties over the course it runs. I know how to differentiate between what key was pressed and for what keys I want to listen, but need to know how I can determine if a key has just been pressed once, like typing, or if a key is being held down for a longer period of time, so that I can have the program make more rapid adjustments the longer the key is

What is the java keyevent field for dot '.'?

陌路散爱 提交于 2019-12-10 17:14:54
问题 I know how to call 1 using keyevent which should be like aaa.keyPress(KeyEvent.VK_1); Now I need to type (.) dot? But I could not find (KeyEvent.VK_DOT) or some similar command. Please help Thanks 回答1: The "dot" is called a period ; hence it's VK_PERIOD. 回答2: Very old question, very basic question, but the correct answer is missing. For regular dot use: KeyEvent.VK_PERIOD For numpad dot use: KeyEvent.VK_DECIMAL 回答3: VK_PERIOD should do what you need. 回答4: VK_PERIOD WILL NOT get it done, by

Android: Key Event from Android Box remote controller

断了今生、忘了曾经 提交于 2019-12-10 14:00:03
问题 I was interested to know how can i catch key/button events from Android TV Box remote controller? For example, i want a popup menu to show when i click the OK button from remote controller. And i want to catch the next/back key events from remote controller. Should i use the Key Event class from Android, if yes how should i implement it? I came across this function but i cannot really make sense of it. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case

How to get keyup/keydown/keypress events on a Windows.Forms.Form that is minimized or not focused?

被刻印的时光 ゝ 提交于 2019-12-10 11:42:25
问题 I'd like to know if is possible to get keyup/keydown/keypress events on a Windows.Forms.Form that is minimized or not focused, so, for example, if I press the Ctrl key the event would be executed on the Form. It's possible to do that? How should I proceed to get this result? 来源: https://stackoverflow.com/questions/17056235/how-to-get-keyup-keydown-keypress-events-on-a-windows-forms-form-that-is-minimiz

Java KeyBindings Combination does not work

旧街凉风 提交于 2019-12-10 11:36:18
问题 I'm struggling with creating a way to identify key combinations. Before I can even set any booleans, I noticed that certain key combinations lead to ignoring other keys. package question; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; public class

How to programmatically send a key event to any window/process in a Java App?

我们两清 提交于 2019-12-10 11:34:24
问题 Using a Java app, how can I programmatically send/trigger a key event (letters,numbers,punctuation, arrows, etc) to a window/process on the same machine? 回答1: Assuming you know a position that window will be you could use java.awt.Robot This types a in whatever window is covering 10,50 on the screen. Robot r = new Robot(); r.mouseMove(10, 50); r.mousePress(InputEvent.BUTTON1_MASK); r.mouseRelease(InputEvent.BUTTON1_MASK); r.keyPress(KeyEvent.VK_A); r.keyRelease(KeyEvent.VK_A); If you had one

How to use back button to go back with XWalkView of CrossWalk, or disable it?

蹲街弑〆低调 提交于 2019-12-10 11:06:32
问题 I use below code to go back in webview at first try. But for the low render ability, I used XWalkView replace the WebView. public boolean onKeyDown(int keyCode, KeyEvent event) { WebView mWebView = (WebView) findViewById(R.id.webview); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (mWebView.canGoBack()) { mWebView.goBack(); } else { finish(); if (MainActivity.mTencent.isSessionValid()) { MainActivity.logout(); } } return true; } } return

Press Power button Twice to send SMS

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 10:24:55
问题 I have written an app in which the user can send messages whenever they press a button given in the activity, and it works fine for me, but now my target is to send SMS by using double press on power button . but I don't have any idea, how to do that ? Send SMS by using double press on power button below is the code, which I am using to send SMS: btnPanic.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String message = "My

Handling arrow key events on a winform textbox without overriding

喜夏-厌秋 提交于 2019-12-10 07:42:02
问题 I have a situation where I'm provided with a WinForms TextBox instance which I want to attach autocomplete functionality to. I've got the autocomplete (string matching + dropdown) all figured out and it works reliable so far. What is the ability to navigate the dropdown with the keyboard (as is the norm with this sort of UI). The natural solution would be to handle KeyDown (or somesuch) event for the textbox and moving the selection in the dropdown accordingly. However, it happens that to do

Simulating combination of key presses from ADB terminal

廉价感情. 提交于 2019-12-09 12:09:57
问题 I want to send " CTRL + W " to the Chrome for Android to close active tab. I tried lots of things but there is no success to achieve it from terminal. (If i connect a USB Keyboard with OTG, i can close the tab with CTRL+W) Firstly i do not want to write a application for this, i only want a shell command to use it from Tasker. I read somewhere that to achieve this (CTRL+W keypress), i have to simulate key presses like this: Down CTRL Down W Up W Up CTRL And to achieve this from terminal, it