1
私はそれについて多くの記事を見ましたが、それは複雑に見えます。ここで私のコードは、gui textAreaの情報を表示する最も簡単な方法は何ですか?あなたが更新したい場合はguiにテキストを表示する最も簡単な方法は?
textArea.setText(s + "\n");
:
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