G
Gast2
Gast
Hallo,
ich hab ein Problem ich möchte meinen Process in einem JTextArea ausgeben...Doch das Programm friert danach komplett ein!!! Was mache ich falsch?
ich hab ein Problem ich möchte meinen Process in einem JTextArea ausgeben...Doch das Programm friert danach komplett ein!!! Was mache ich falsch?
Java:
public class ProcessDialog extends JDialog {
private JTextArea textArea;
private Process process;
public ProcessDialog(Frame owner) {
this(owner, null);
}
public ProcessDialog(Frame owner, Process process) {
super(owner);
this.process= process;
installComponents();
}
private final void installComponents() {
setTitle("Server...");
textArea = new JTextArea();
add(textArea, BorderLayout.CENTER);
try {
area.read(new InputStreamReader(process.getInputStream()), null);
} catch (IOException e) {
e.printStackTrace();
}
}
public void setTextArea(JTextArea textArea) {
this.textArea = textArea;
}
public JTextArea getTextArea() {
return textArea;
}
public void append(String str) {
textArea.append(str);
}
}
Java:
ProcessBuilder processBuilder = new ProcessBuilder("iperf", "-s");
try {
processBuilder = processBuilder.redirectErrorStream(true);
process = processBuilder.start();
ProcessDialog dialog = new ProcessDialog(
frame, process);