Looping through arraylist java -
hi i'm working on creating sortof bank application using javafx8. seem having problem regards adding new account. i'm trying create loop read list if same business relationship number exist , prompt user exist. can please check i'm doing wrong.
btw have corrected out typo's eclipse asks me right before compiling
this list in main app private observablelist<person> persondata = fxcollections.observablearraylist();
here did access list on class
public observablelist<person> getpersondata() { homecoming persondata; }
and here in personeditdialogcontroller class access list did this
mainapp mainapp = new mainapp(); observablelist<person> persondata = mainapp.getpersondata();
and here code verify user input
private boolean isinputvalid() { string errormessage = ""; if (accountnumfield.gettext() == null || accountnumfield.gettext().length() == 0) { errormessage += "not valid business relationship number!\n"; } //to loop through list person person = null; (person : persondata) { if ((accountnumfield.gettext().equalsignorecase(a.getaccountnum()))){ person = a; break; } } // code not work if (accountnumfield.gettext().equals(person)){ errormessage += "account number exist\n"; } if (errormessage.length() == 0) { homecoming true; } else { // show error message. dialogs.create() .title("invalid fields") .masthead("please right invalid fields") .message(errormessage) .showerror(); homecoming false; } }
it appears me have unbalanced curly braces (there's closing curly brace } after line person = a;
) , function seems end after loop.
java arraylist javafx-8
No comments:
Post a Comment