嗨,我有这个从控制台读取一行的简单代码,现在我想从文本区域读取这一行,就像控制台一样(按 Enter 应该读取该行)我该怎么办?
private DataInputStream co = null;
private DataOutputStream streamOut = null;
public void run()
{ while (thread != null)
{ try
{
streamOut.writeUTF(co.readLine());
streamOut.flush();
}
catch(IOException ioe)
{ System.out.println("Sending error: " + ioe.getMessage());
stop();
}
}
}