java - How do I append data all into one dialog box? -
i have problem address book program. view entries address book, displayed in different dialog boxes. first entry displayed in first dialog box , if click "ok" next entry shown in dialog box. want entries shown in 1 dialog box.
here's getter method:
public string getinfo(){ string info = "name\taddress\tphone no.\te-mail add\n" + name +"\t " + add +"\t "+ phoneno +"\t "+ email +"\n"; return info; }
here's how display information:
public void viewall() { (int = 0; < counter; i++) { joptionpane.showmessagedialog(null, new jtextarea(entry[i].getinfo())); } }
hope can me... in advance :)
in order view entries inside 1 dialog box, can try creating string add entries. see code below:
public string getinfo() { string content = "\t" + name + "\t"+ address + "\t\t" + telno + "\t" + email; return content; } public class addressbook public void viewallentry() { string addtext = "no\tname\taddress\t\ttel.no\temail\t\n"; /<------here (int = 0; < addressbookentrycounter; i++) { addtext = addtext+(i+1)+ entry[i].getinfo()+ "\n"; /<------here } joptionpane.showmessagedialog(null, new jtextarea(addtext)); } }
you try ninesided's solution
Comments
Post a Comment