View Single Post
Old 01-26-07, 08:28 PM   #25
Marvel_us
FOOL!
 
Marvel_us's Avatar
 
Join Date: Dec 2005
Location: Miami, Florida
Posts: 3,754
Default Re: Sigh, Java HW Help

So I'd need to create two strings, one that holds the toString for a specific object and assign the other string variable to the first string? Wouldn't the string get replaced after every loop or would it hold all of them?

Then use the joptionpane outside of the loop, right?

Something like:
Quote:
public void DisplayList()
{
for(int i = 0; i < accounts.size(); i++)
{
Customer c = accounts.get( i ) ;

String s = c.toStringCustomer() ;

String r += s ;
}

JTextArea text = new JTextArea(r, 40, 40);
JScrollPane pane = new JScrollPane(text);


JOptionPane.showMessageDialog(null, pane, "Account Information",
JOptionPane.INFORMATION_MESSAGE);

}
__________________
Main Rig
Intel Q6600 QUAD|| Gigabyte P35-DS3L ||XFX 7900GTX|| G.Skill 6GB PC2-6400 || OCZ Agility 60GB SSD || WD 320GB + WD Green 1TB HDD || Samsung 20" LCD || CoolMax 650W PSU ||

60gb PS3 Owner
PSNid: Marvel_us
Marvel_us is offline   Reply With Quote