如何在用戶按任意鍵然後執行某些/重複方法時檢測鍵盤輸入,除非沒有擺動/ awt的退出按鈕?用BufferedReader按Java中的Anykey
public static void isChecking(String x)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String anykey = null;
System.out.print("Press Anykey to Continue : ");
anykey = br.readLine();
//if pressanykey
main(null); //call main class
//if escape button
System.out.println("Good Bye ");
System.exit(1);
}
謝謝
MRizq
在哪裏「任意鍵」? –
除非轉義鍵 – MRizq