java - Validating a buffered value in JGoodies Binding -


i use code:

jtextfield textfield = basiccomponentfactory.createformattedtextfield(valuemodel, numberformatter); 

this causes jtextfield work nicely, automatically changes 512.1!5 512.1 no errors when commit trigger bound presentation model. great how smoothly works popup jdialog saying hey, inputted 512.1!5 contained invalid value user knows happened. cannot find hook in jgoodies binding set up. tried adding propertychangelistener on presentatonmodel's getbufferedcomponentmodel() report values had ! character missing. therefore lost on how detect format error, there jgoodies bean listener allow me know when alert user?

you can use jgoodies validator interface validate whatever input there on textfield write own validator class implements following interface. instance class name textfieldvalidator.

validator<t> 

precondition bind textfield presentationmodel.

textfieldvalidator<t> validator = (textfieldvalidator<t>) getpresentationmodel().getvalidator();         validator.setcomponent(getyourtextfield()); 

setcomponent set jtextfield reference in textfieldvalidator class , in validate() method can show pop ups/change background colors or not.

hope helps.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -