Results 1 to 4 of 4
- 05-18-2012, 10:11 AM #1
Member
- Join Date
- May 2010
- Posts
- 9
- Rep Power
- 0
How to use Validation API to validate Java Swing forms in Netbeans
I was searching for a Swing Forms Validation API in NetBeans and saw one at How to Quickly Add Validation Code to Swing UIs | Javalobby. I downloaded and installed the "Simple Validation" NetBeans Plug-in from Simple Validation: Downloads — Project Kenai, but do not know how to use it, because I cannot find where is it present (in toolbox).
Can anyone kindly help me by telling how where can I find it and what are the steps to apply the validation on my form fields.
I also saw there was a Validation API JAR file and I downloaded and included it in my project. It provided 3 controls (or whatever to call it); "ValidationPanel", "ValidationUtils" and "Problems". I saw an example & followed it. I dragged-and-dropped the "ValidationPanel" and wrote the code as shown in following code
final ValidationGroup group = validationPanel1.getValidationGroup();
group.add(txtUserName, Validators.REQUIRE_NON_EMPTY_STRING,
Validators.NO_WHITESPACE,
Validators.REQUIRE_VALID_INTEGER);
But it seems JAR file contains incomplete files or there may be other problem, because it gives error: cannot find symbol: variable "Validators"
When I wrote the code in NetBeans it gave same error for "ValidationGroup" class and when I clicked on a balloon on the left side of IDE it suggested me to import the package for it and when I clicked on it, it imported the package, but it does not suggest me to import package for "Validators"
I am sorry I think these are 2 questions, but kindly help me how to solve it.
Thanks in advance
- 05-18-2012, 11:20 AM #2
Re: How to use Validation API to validate Java Swing forms in Netbeans
Moved from AWT/Swing
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 06-22-2012, 07:07 AM #3
Member
- Join Date
- Jun 2012
- Posts
- 1
- Rep Power
- 0
Re: How to use Validation API to validate Java Swing forms in Netbeans
Now you have to use StringValidators insted of Validators to get the validator constants.
group.add(txtUserName, StringValidators.REQUIRE_NON_EMPTY_STRING,
StringValidators.NO_WHITESPACE,
StringValidators.REQUIRE_VALID_INTEGER);
To use the merge method you have to use ValidatorUtils.merge(..)
I hope it helps you.
Norberto
-
Re: How to use Validation API to validate Java Swing forms in Netbeans
Post to re-activate an old thread deleted. Thread closed.
Similar Threads
-
how to do validation using java swing?
By Vignesh Karthick in forum AWT / SwingReplies: 3Last Post: 01-25-2013, 01:38 PM -
Showing NetBeans-generated Swing forms
By _SAS in forum AWT / SwingReplies: 0Last Post: 06-19-2010, 02:45 AM -
How do I validate user input from forms with Java?
By rickywh in forum New To JavaReplies: 2Last Post: 01-30-2010, 06:49 AM -
How to make online jsp forms from Microsoft word forms in java
By jiten.mistry in forum Advanced JavaReplies: 2Last Post: 04-28-2008, 10:56 AM -
Creating Sub forms in java netbeans 5.0
By java_newbie in forum NetBeansReplies: 14Last Post: 08-06-2007, 07:19 PM


1Likes
LinkBack URL
About LinkBacks

Bookmarks