File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Java Timers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java Timers" Watch "Java Timers" New topic
Author

Java Timers

Mayur Gosalia
Ranch Hand

Joined: Jan 03, 2010
Posts: 54
Hi,

I know how to setup timers and use them to refresh labels etc. What i am struggling to figure out is how to how refresh a entity that is being returned.

What i have is JTabs, which calls other functions to create JPanels and add it to the tabs. I have a JPanel full of labels, which is displaying data from a array i want to be able to refresh this using a timer but i am struggling because the panels needs to be returned, so that i can be added to the Jtabbed pane. Any ideas on how to get across this one? I have tried making the panels global but it doesnt like the return type, your ideas/help is appreciated.

Thanks
Mayur
Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
Hi Mayur,

Can you please elaborate little more in detail. Also please tell us the exact place where you are stuck [If you can post your code, that would be of great help].


Karthick D V
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38729
    
  23
And beware: there are two classes called Timer
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if this is a follow on from your reloading panel post,
from your description in that post a timer would be the wrong way to do it.

you need to spend some time creating a program that simulates your program
ie hard coded data (no db connection stuff), so that we can run the program and see
exactly how you're loading the panel to start, and how you're modifying the data
Mayur Gosalia
Ranch Hand

Joined: Jan 03, 2010
Posts: 54

error posting
Mayur Gosalia
Ranch Hand

Joined: Jan 03, 2010
Posts: 54
Thanks guys i have managed to sort this one out..just took a bit of working out got there in the end..appreciate your help.
Daniel Faria
Greenhorn

Joined: Dec 25, 2007
Posts: 15
I used



Is it you need??


Where timeCentral is an variable of type javax.swing.Timer.
I wait have help.
Mayur Gosalia
Ranch Hand

Joined: Jan 03, 2010
Posts: 54
yes mine and urs is similar..only difference is my method is not void it has a return type.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38729
    
  23
It's "yours", please not "urs".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Timers