This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Timers

 
Mayur Gosalia
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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].
 
Campbell Ritchie
Sheriff
Posts: 48441
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And beware: there are two classes called Timer
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

error posting
 
Mayur Gosalia
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used



Is it you need??


Where timeCentral is an variable of type javax.swing.Timer.
I wait have help.
 
Mayur Gosalia
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes mine and urs is similar..only difference is my method is not void it has a return type.
 
Campbell Ritchie
Sheriff
Posts: 48441
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's "yours", please not "urs".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic