java - Cannot find method symbol -
i don't know if can explain , post proper code make clear, try. have 5 classes. being used check validity of isbn number. getting error "cannot find symbol - method getisbn(). have gui object have instantiated. error comes handler, here:
public void actionperformed(actionevent e) { if (e.getsource()==gui.validatebutton) { try { gui.isbntext.getisbn();/////////////error////////// gui.status.settext("isbn " + isbntext.booknum + " valid"); } catch(isbnexception er) { gui.status.settext(er.getmessage()); } } else system.exit(0);
i wont post code gui, idea: theres gui, has textfield called isbntext, , in isbntext class, there method retrieve text, called getisbn, code:
public isbntext() { super(20); } //retrieve isbn num textfield public string getisbn() throws isbnexception { booknum = gettext(); validateisbn(booknum); return booknum; }
i hope enough, not much, go on. ideas?
without seeing gui class, it's difficult say. suspect isbntext
field declared :
jtextfield isbntext = new isbntext();
if that's case, getisbn() can't found because variable's declared type jtextfield, , not isbntext. need change
isbntext isbntext = new isbntext();
note public variables should never used, , variables in java should start lower-case letter. should call isbntext
rather isbntext
.
Comments
Post a Comment