X

Geertjan's Blog

  • August 31, 2010

Validation API in an OutlineView and Properties Window

Geertjan Wielenga
Product Manager
Tim's Validation API (which is in the "ide" cluster in your NetBeans IDE installation directory), in action in an OutlineView:

And in the Properties window:

To achieve the above, you need to create an InPlaceEditor for your Property. (In the example above, I use a JTextField.) Within the InPlaceEditor's constructor, I simply have this:

ValidationPanel panel = new ValidationPanel();
ValidationGroup group = panel.getValidationGroup();
group.add(
textField,
Validators.REQUIRE_NON_EMPTY_STRING,
Validators.NO_WHITESPACE,
Validators.URL_MUST_BE_VALID);

...which is copied from here:

http://netbeans.dzone.com/news/how-quickly-add-validation

By the way, thanks Henry Kleynhans in Johannesburg for the above idea!

Join the discussion

Comments ( 3 )
  • Oliver Rettig Thursday, September 2, 2010

    Hi Geertjan,

    I can not find the "Tims validation API" in the NB 6.9.1 platform in the ide cluster. Is it in a newer version or has it an other place.

    Thanks

    Oliver


  • Geertjan Thursday, September 2, 2010

    install-dir/ide/modules/ext/ValidationAPI.jar


  • Susanta Tewari Monday, July 18, 2011

    Is the source code for the example available ?

    Thanks,

    Susanta


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha