我试图将用户输入的字符串附加到使用全局按键和我找到的 api 中。但是我不知道如何在不覆盖已经存在的情况下添加到字符串中。
int i = 1;
public String log = "Write";
public String[] logger = new String[i];
public static PrintStream out = null;
public BufferedWriter writer = null;
public void nativeKeyPressed(NativeKeyEvent e) {
while(i<1000000000){
logger[i] = NativeKeyEvent.getKeyText(e.getKeyCode());
i++;
System.out.println(logger[i]);
}