如何在不覆盖Java的情况下将文本追加到JTextArea中已有的文本 [英] how to append text to text already in JTextArea without overriding in java
本文介绍了如何在不覆盖Java的情况下将文本追加到JTextArea中已有的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
here is my code
for(int y=0,size1= nList1.getLength(); y<size1; y++)
{
String xlessonname = nList1.item(y).getAttributes().getNamedItem("name").getNodeValue();
String xmarks = nList1.item(y).getAttributes().getNamedItem("marks").getNodeValue();
String xlevel = nList1.item(y).getAttributes().getNamedItem("level").getNodeValue();
uinfo.setText("\t "+xlessonname+" \t "+xmarks+" \t "+xlevel+"\n");
}
我从y = size-1获取输出作为值.我希望在每次循环迭代时将文本添加到新行中.如何做到这一点?
Im getting the output as values from y=size-1.I want text to be appended in new line for each iteration of loop.How to do that?
推荐答案
使用
uinfo.setText(uinfo.getText()+文本+"\ t" + xlessonname +"\ t" + xmarks +"\ t" + xlevel +"\ n");
use
uinfo.setText(uinfo.getText() + text +"\t "+xlessonname+" \t "+xmarks+" \t "+xlevel+"\n");
这篇关于如何在不覆盖Java的情况下将文本追加到JTextArea中已有的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文