posted 14 years ago
[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
OCPJP 6.0 93%
OCPJWCD 5.0 98%