所以基本上我正在做的是从arraylist获取所有条目并在JOptionPane窗口中显示它们。但问题是每个条目每次都会打开一个新的JOPtionPane。有没有办法列出一个JOptionPane中的所有条目?谢谢。
for ( int i = 0; i < LoansList.size(); i++)
{
Loans myLoans = (Loans) LoansList.get(i);
JOptionPane.showMessageDialog(null, myLoans.showDetails() + "\n ",
"", JOptionPane.INFORMATION_MESSAGE);
}
答案 0 :(得分:0)
这样做怎么样:
String acc = "";
for (int i = 0; i < LoansList.size(); i++)
{
Loans myLoans = (Loans) LoansList.get(i);
acc += myLoans.showDetails () + "\n";
}
JOptionPane.showMessageDialog(null, acc, "", JOptionPane.INFORMATION_MESSAGE);