I’m currently writing a basic terminal in lemur,
now I want to execute the entered command when enter is pressed, how would I do this correctly? Is there already some kind of keylistener I can hook into?
For my console I used:
textField.getActionMap().put(new KeyAction(KeyInput.KEY_RETURN), new KeyActionListener() {
@Override
public void keyAction(TextEntryComponent arg0, KeyAction arg1) {
// Enter pressed code
}
}
I’m not sure if it is the proper way but it works
2 Likes
Works for me Thanks
Yep, that’s exactly right.
Do note: apparently on Macs the enter key is different and you have to use the numpad enter or something. At least I have a vague memory of such.