ArrayList list_of_employees = new ArrayList();
@Action
public void reportAllEmployeesClicked(java.awt.event.ActionEvent evt)
{
this.outputText.setText("");
int i=0;
//JOptionPane.showMessageDialog(null,"test Employee list print");
ListIterator list_ir = list_of_employees.listIterator(); //list_of_employees is of
//obj type ArrayList
while(list_ir.hasNext())
{
String o = new String();
o = (String) list_ir.next();
this.outputText.setText(""+o); // this does not work, why? nothing happens
//no errors and no output
i++;
JOptionPane.showMessageDialog(null,o); // this works
}
}
outputText是嵌套在滾動窗格內的JTextArea類型。 當我設置正常字符串變量的文本輸出顯示,因爲它應該。 作爲循環運行我能夠通過JOptionPane獲得輸出。 存儲在列表中的所有對象都是String對象。 如果有更多信息需要我提供以方便更準確的答案,請告訴我。爲什麼試圖將一個arrayList對象輸出到JtextArea不起作用?
感謝 -Will-
我錯過了在Java API來JTextArea的該TID位。非常感謝。 – 2010-10-27 19:25:09