Skip to main content

how to validate textfield of new gui resource editor

1 reply [Last post]
sahoorashmita
Offline
Joined: 2011-03-23
Points: 0

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.
vprise
Offline
Joined: 2003-11-07
Points: 0

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.

http://lwuit.blogspot.com/2011/04/generating-netbeans-project-from.html