Skip to main content

how to validate textfield of new gui resource editor

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2011-03-23

Hi All,
I having netbeans project that was generated from new gui builder resource editor.
I am having two textfield and one button in the form. I want to validate a textfield when i clicked on the button of the form. For example i have name textfield in the form. So when i click on the button i want to dislpay an error dialog if name textfield text is blank.
Is it possible to do it? So please give me some code or example as possible as soon.
Advance Thank you and sorry for my english.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-11-07

If you are using a command on the button click the Command entry and click the go to source button within it. Insert the code you want.
Return true from the method to disable the navigation following the command (in case of invalid) you can show any dialog you want indicating the error. The true return value means you handled the command and don't want LWUIT to proceed with navigation.

If you didn't use commands you can just use an actionListener event and do whatever you want in the code.