Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Validation with AbstractValidator Problem  RSS feed

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!