1
我見過很多關於它的帖子,但看起來很複雜。這裏是我的代碼,什麼是在gui textArea上顯示信息的最簡單方法?在gui中顯示文本的最簡單方法?
public static void runSystemCommand(String command) {
String message=null;
int i=0;
while (i<1) {
try {
Process p = Runtime.getRuntime().exec(command);
BufferedReader inputStream = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String s = "";
// reading output stream of the command
while ((s = inputStream.readLine()) != null) {
//here i dont know what to type..please help
}
Thread.sleep(9000);
} catch (Exception e) {
e.printStackTrace();
}
i++;
}
}
這是關於JTextArea,還是隻是想要類似JavaScript的'alert()'? – Laurel
'textArea.append(s +「\ r \ n」)'應該適用於這種情況嗎? –
JTextArea組件 – swipeales