java - JavaFX2 StackOverflowError at ObservableListWrapper -


i trying use filter on text field. problem getting exception:

java.lang.stackoverflowerror @ com.sun.javafx.collections.observablelistwrapper.size(observablelistwrapper.java:335) 

i can't understand why exception thrown, because had similar code , there no stackoverflowerror. think settext() calling listener again , again, why there no error on similar code did before?

public static void addnumericfilter(final textfield tf) {     tf.textproperty().addlistener(new changelistener<string>() {         @override         public void changed(observablevalue<? extends string> value, string oldvalue, string newvalue) {             //system.out.println("text = " + tf.gettext());             system.out.println("value = " + value.getvalue());             system.out.println("oldvalue = " + oldvalue);             system.out.println("newvalue = " + newvalue);              try {                 integer.parseint(value.getvalue());             } catch (numberformatexception ex) {                 tf.settext(oldvalue);             }         }     }); } 

this code works perfectly, example (why there not stack overflow here?):

public static void adduppercasefilter(final textfield tf) {     tf.textproperty().addlistener(new changelistener<string>() {         @override         public void changed(observablevalue<? extends string> value, string oldvalue, string newvalue) {             tf.settext(value.getvalue().touppercase());         }     }); } 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -