Link to home
Start Free TrialLog in
Avatar of MILIND_JOG
MILIND_JOGFlag for India

asked on

unable to set Timer on a jTextField

Dear Experts,
I am designing a JDialog which contains few jTextFields. One of that belongs to time. I am unable to set timer against that so as to get system time on the JDialog.
 I have tried but getting some error in timer = new Timer(500,this); Compilation showing error agains the word "this" and the error is " cannot be converted to java.awt.event.ActionListener by method invocation conversion". Please find the code for reference. If I remove the word "this" by "null" the error doesn't appair but required result not getting. onlt first time I am able to see the time on jTableField but not able to get real time after words.

Please help
Regards
Avatar of ksivananth
ksivananth
Flag of United States of America image

try OuterClassName.this

where OuterClassName is the name of the class which holds the class implementation of ActionListener
Avatar of mccarl
Please find the code for reference
Couldn't find it... can you post it?
Avatar of MILIND_JOG

ASKER

Sorry I forgot to attach source file. Please find the same.

Regards
newGuest.java
Your class should really be extending JFrame not JDialog, and using JPanels with LayoutManagers to display your text fields etc.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks CEHJ,

The issue is resolved.

Regards
:)