keyboard

Keyboard input in Java Applet

為{幸葍}努か 提交于 2021-02-16 18:06:53
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

Keyboard input in Java Applet

三世轮回 提交于 2021-02-16 18:06:49
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

Keyboard input in Java Applet

China☆狼群 提交于 2021-02-16 18:05:44
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

What is keyboard hook?

三世轮回 提交于 2021-02-11 14:04:26
问题 I was reading the Doc of Autohotkey and then I was not able to understand the meaning of the phrase 'keyboard hook' or 'mouse hook'. this is the text: " The $ prefix has no effect for mouse hotkeys, since they always use the mouse hook. It also has no effect for hotkeys which already require the keyboard hook " URL: https://www.autohotkey.com/docs/Hotkeys.htm 回答1: 1 - A Keyboard Hook or Mouse Hook that Means: that you can monitor/receive all the keyboard keypress values or that you monitor

SwiftUI - Why does the keyboard pushes my view?

天大地大妈咪最大 提交于 2021-02-11 06:35:29
问题 Why do I have the keyboard that pushes up my View? Here's the code: import SwiftUI struct ContentView : View { @State var searchText = "" @State var pressedFirstButton = false @State var pressedSecondButton = true @State var pressedThirdButton = false var body : some View { NavigationView { VStack { if pressedSecondButton == true { Form { SearchBar(testo: $searchText) .padding(.horizontal, -10) Text("ForEach") } } HStack { Spacer() buttonFirst Spacer() buttonSecond Spacer() buttonThird Spacer

SwiftUI - Why does the keyboard pushes my view?

蹲街弑〆低调 提交于 2021-02-11 06:35:07
问题 Why do I have the keyboard that pushes up my View? Here's the code: import SwiftUI struct ContentView : View { @State var searchText = "" @State var pressedFirstButton = false @State var pressedSecondButton = true @State var pressedThirdButton = false var body : some View { NavigationView { VStack { if pressedSecondButton == true { Form { SearchBar(testo: $searchText) .padding(.horizontal, -10) Text("ForEach") } } HStack { Spacer() buttonFirst Spacer() buttonSecond Spacer() buttonThird Spacer

How to detect key arrow key press in C++ in OSX?

岁酱吖の 提交于 2021-02-10 20:30:56
问题 I am trying to make a terminal snake game in C++ in macOSX. How do I detect which arrow key is pressed? I tried to do this with getch() of ncurses.h but this is not solving the problem. No output is being detected. #define KEY_UP 72 #define KEY_LEFT 75 #define KEY_RIGHT 77 #define KEY_DOWN 80 void Input() { int c = 0; switch ((c = getch())) { case KEY_UP: cout << endl<< "Up" << endl; //key up break; case KEY_DOWN: cout << endl<< "Down" << endl; // key down break; case KEY_LEFT: cout << endl<<

Bash - How to run code whenever USB device is connected

China☆狼群 提交于 2021-02-10 15:43:40
问题 I am writing a bash script to automatically detect when my USB keyboard is plugged into my laptop (running Ubuntu 14), so I can change the keyboard layout automatically. Here is my code so far (I got it from another post on Stack Overflow so I'm not 100% sure how it works) #!/bin/bash setxkbmap es for dev in /sys/bus/usb/devices/ *-*:* do if [ -f $dev/bInterfaceClass ] then if [[ "$(cat $dev/bInterfaceClass)" == "03" && "$(cat $dev/bInterfaceProtocol)" == "01" ]] then setxkbmap gb fi fi done

Know default keyboard on android

给你一囗甜甜゛ 提交于 2021-02-10 15:16:22
问题 I want to know the default keyboard chosen by the user in Android. I know I can access the list of enabled input methods using the InputMethodManager , but I want to know which one is the user currently using. So far, I've tried to get the current input method subtype: InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE); InputMethodSubtype subtype =imeManager.getCurrentInputMethodSubtype(); But this object only seems to give me

Know default keyboard on android

痞子三分冷 提交于 2021-02-10 15:16:16
问题 I want to know the default keyboard chosen by the user in Android. I know I can access the list of enabled input methods using the InputMethodManager , but I want to know which one is the user currently using. So far, I've tried to get the current input method subtype: InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE); InputMethodSubtype subtype =imeManager.getCurrentInputMethodSubtype(); But this object only seems to give me