Results 1 to 5 of 5
  1. #1
    asifzbaig is offline Member
    Join Date
    May 2011
    Posts
    56
    Rep Power
    0

    Default How can i get a string value in return of a thread class to use to show current time?

    Buddies just get me out of this situation please...
    I am making a swing GUI application in which i need to show current time by a label....
    Can i get a thread class that can run alon with my GUI and returns the current time or update the current time that can b use as text for theat label????

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  3. #3
    asifzbaig is offline Member
    Join Date
    May 2011
    Posts
    56
    Rep Power
    0

    Default

    Can you pleeez explai with an example code??
    I did not use it before....

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    The Oracle Swing tutorials will better explain this than I can, and they have example code as well. Google can help you find this.

    Best of luck.

  5. #5
    asifzbaig is offline Member
    Join Date
    May 2011
    Posts
    56
    Rep Power
    0

    Default

    Thanks alot....
    It finally worked as i want it to be...

    i use example code of swing tutorials and modified it slightly and it started working.....

    //in frame class contructor:
    int delay = 1000; //milliseconds
    ActionListener taskPerformer = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    //...Perform a task...
    }
    };
    new Timer(delay, taskPerformer).start();

Similar Threads

  1. Replies: 10
    Last Post: 04-21-2011, 01:47 PM
  2. need help with getting current time in Millis
    By Clerek in forum New To Java
    Replies: 11
    Last Post: 01-26-2011, 05:50 AM
  3. Replies: 1
    Last Post: 08-16-2010, 10:49 AM
  4. Current Time in millisecs
    By jitman in forum New To Java
    Replies: 1
    Last Post: 03-11-2010, 05:16 PM
  5. how to get the current date and time
    By valery in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 06:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •