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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

need help in applying inputverifer to jtextfield

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

[b]1.facing problem in applying input verifier to JTextfield
[/b]

main class
VerifierTest




NotEmptyValidator.java





AbstractValidator -extended by NotEmptyValidator



interface



when i run the VerifierTest after compling all other files,i get the following error


VerifierTest.java:19: parent is not public in java.awt.Component; cannot be accessed from outside package
tf1.setInputVerifier(new NotEmptyValidator(parent, tf1, "Field cannot be null."));
^
VerifierTest.java:19: cannot find symbol
symbol : constructor NotEmptyValidator(java.awt.Container,javax.swing.JTextField,java.lang.String)
location: class NotEmptyValidator
tf1.setInputVerifier(new NotEmptyValidator(parent, tf1, "Field cannot be null."));
^
2 errors


can anyone correct the code .i have tried to change the call
tf1.setInputVerifier(new NotEmptyValidator(parent, tf1, "Field cannot be null."));

to

tf1.setInputVerifier(new NotEmptyValidator((JDialog)parent, tf1, "Field cannot be null."));

but still the error comes

i would be grateful if somebody removes this error as i need for my college project


and

2.i tried the following change


no optionPane or color of textfield changes
 
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please stick to your old thread. UseOneThreadPerQuestion. I've already shown you why it fails there - parent resolves to the private (or package default) field of java.awt.Component. You need to have a JDialog and use that as the first parameter.

Closing this thread.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic