Solved

unable to set Timer on a jTextField

Posted on 2013-01-08
7
224 Views
Last Modified: 2013-01-23
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
0
Comment
Question by:MILIND_JOG
7 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 38754340
try OuterClassName.this

where OuterClassName is the name of the class which holds the class implementation of ActionListener
0
 
LVL 35

Expert Comment

by:mccarl
ID: 38754408
Please find the code for reference
Couldn't find it... can you post it?
0
 

Author Comment

by:MILIND_JOG
ID: 38754455
Sorry I forgot to attach source file. Please find the same.

Regards
newGuest.java
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 16

Expert Comment

by:krakatoa
ID: 38754666
Your class should really be extending JFrame not JDialog, and using JPanels with LayoutManagers to display your text fields etc.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 38754813
@Override
                public void actionPerformed(ActionEvent evt) {
                actionPerformed(evt);//<< NO!
                };
        });

The above line in actionPerformed will do nothing other than cause problems by attempting to make a recursive call. Do something sensible in there instead - there's nothing otherwise wrong with the Timer
0
 

Author Closing Comment

by:MILIND_JOG
ID: 38810429
Thanks CEHJ,

The issue is resolved.

Regards
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38811250
:)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
web services creation SOAP vs REST 5 56
Groovy problem when using SOAPUI : DispatchException occurred 7 58
sql import cannot be resolved jsp 3 46
collection output issue 9 36
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question