我需要将变量附加到TextArea
. 已TextArea
编码,并且可以完美运行。我可以TextArea
通过使用从 中检索信息TextArea.getText();
为了将其分开,我正在尝试使用BufferedReader
. 不幸的是,这不起作用。有不同的方法吗?以下是如何将信息写入文本区域的示例:
“工人姓名”
“工人部门”
“工人编号”
BufferedReader inStream= new BufferedReader
(new InputStreamReader(TextArea.getText()));
String workerName = "";
String workerDepartment = "";
int workerNumber = 0;
String line = inStream.readLine();
while (line != null) {
workerName = line;
line = inStream.readLine();
workerDepartment = line;
line = inStream.readLine();
workerNumber = Integer.parseInt(line);
}
inStream.close();