java - Non-static method getText() can not be referenced from a static context -


i have written following code, continually 'non-static method gettext() can not referenced static context' error.

could me on right track here?

public class isbntext extends jtextfield {      protected static string booknum;    protected jtextfield  booktext;     public isbntext()     {        super(20);        booktext = new jtextfield();    }       public string getisbn()    {                  string booknum = isbntext.gettext();       return booknum;    }    private string validateisbn(string booknum) } 

this line:

string booknum = isbntext.gettext(); 

should be:

string booknum = gettext(); 

which implicitly:

string booknum = this.gettext(); 

the call isbntext.gettext() trying call if it's static method - i.e. associated type rather specific instance of type. doesn't make sense, text is associated instance of type. 2 alternatives i've shown equivalent, finding text of isbntext getisbn has been called on.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -