我正在尝试显示我在 textarea 中获得的所有数据
public static void randNumQueue(){
Queue<String> myQueue = new LinkedList<>();
if(average12==30){
long range = (long)randNum2 - (long)randNum1 + 1;
long fraction = (long)(range * random.nextDouble());
number = (int)(fraction + randNum1);
System.out.println(number);
Set mySet = new HashSet();
for (int j = 0; j<number; j++)
{
int pick;
do{
pick = random.nextInt(number)+1;
}while(!mySet.add(pick));
myQueue.add(Integer.toString(pick));
}
System.out.println("the queue size: "+myQueue.size());
sizeQ = myQueue.size();
Iterator it = myQueue.iterator();
while(it.hasNext()){
String iteratorValue = (String)it.next();
Qnum = Integer.parseInt(iteratorValue);
System.out.println("queue next value: "+Qnum);
}
}
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(b1)){
randomAverage();
testAmount = testAmount + 1;
label5.setText(""+testAmount);
area3.setText(""+sizeQ);
area1.setText(""+Qnum);
}
}
area1 是我试图显示从 IteratorValue 获得的所有数据的区域文本
从上面的函数 area1 只显示了我从 iteratorValue 得到的最后一个值
有人知道如何显示 area1(textarea) 中的所有值吗?