• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation with AbstractValidator Problem

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am making a java application and i used the code from following links


http://www.javalobby.org/java/forums/t20551.html
http://www.javalobby.org/java/forums/t20552.html

i have used the AbstractValidator class as it is and used the NotEmptyValidator class.when i call the following code from my application

JTextField textField = new JTextField();
textField.setInputVerifier(new NotEmptyValidator(parent, textField, "Field cannot be null."));

the following error occurs

parent is not public in java.awt.Component; cannot be accessed from outside package
textField.setInputVerifier(new NotEmptyValidator(parent, textField, "Field cannot be null."));

can anybody remove this error
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the message is quite clear. Apparently there is an instance field of Component that is not protected or public, and you are unwillingly trying to access that one. You'll need a JDialog with name parent instead.
 
Let's get him boys! We'll make him read this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic