Answer the question
In order to leave comments, you need to log in
How to use KeyListener outside the program?
In the used class I prescribe: public class MyKeyLog implements KeyListener { ... }
Further event processing. This is what I'm interested in:
@Override
public void keyPressed(KeyEvent e) {
char letter = e.getKeyChar();
String total = null;
total = total + letter;
panel.setText(total);
}
In fact, I just made a field in which you can write text. What should be used so that the program can read text written NOT in this field? For example, I can open a notepad file and start writing something there, and the program will read the keyboard letters and mirror them into this panel.
What library or something else should I use? Thank you in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question