Showing system time in a panel..........

AOA
What may be a good appropach or logic to show system time in my application panel. And that time will properly synchronized with system time.
regards

Following is a code snippet.
These functions are members of a class that extends JPanel. You will need to replace calls to some functions not included here (but whose semantics should be obvious).
    private JLabel timelabel;  // this is added to the panel in the usual way
    private Timer timer;
    private ActionListener updateTheTime = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            timeLabel.setText(timeString());
        JLabel timeLabel = new JLabel(timeString(), JLabel.RIGHT);
        add(timeLabel);
        timer = new Timer(1000, updateTheTime);
        timer.start();
    // returns a string with the current date & time
    protected String timeString() {
        // uc is created in another function
        Calendar uc = getMyCalendar(System.currentTimeMillis()));
        StringBuffer b = new StringBuffer(32);
        (new Formatter(b)).format(timeFormat, uc);
        return b.substring(0);
    }This sets up a label and adds a timer that triggers once a second that updates the text within the label.

Similar Messages

  • How to show system time in JApplet?

    Hello,
    I would like to show system time in my JApplet the time should update when the system time is changed. i.e 10:10 is system time and the JApplet should show 10:10 , when the time changes in the system, the time in the JApplet should also be changed without refreshing.
    Any help please?
    Thanks

    push

  • Showing System time using Java Beans

    Hi,
    Anyone have any source code for writing ajava bean using a text-field to show the current system time which is updated very second at run-time.
    Thanks.

    Hello.
    It sounds to me like you are in the wrong forum. This is for Enterprise JavaBeans, a server side tech, and not the GUI type of JavaBeans. For GUI JavaBeans you should take a look at http://forum.java.sun.com/forum.jsp?forum=39

  • Graph / Chart show system time in X-Axis.

    I try to plot the temperature graph/ chart with respect to my system time. The problem is that the if i select the relative time it starts from 00:00 and if i select absolute time it always starts from 05:00 in 24Hrs.
    I need X-Axis Chart/Graph show my system time and in Y- Axis it show the Temperature value which is received from serial port.
    Attachments:
    Temperature Recorder.vi ‏100 KB

    First I am very thankful to you for your kind cooperation. As I am beginner
    my questions may be the unintelligent.
    I have tried it and now the system time shows in graph. I have also a time
    sync problem. After initializing graph with the time being the value of time
    does not match with system time. Some time it is faster with respect
    to system clock and some time it is slower with respect to system clock. I
    observed it is slow when the data of graph is 1 byte long and when the data is
    2 or 3 bytes long it goes fast.
    The another problem is the chart Y-Axis Interpret HEX value (00 to FF) means 0-255
    points only. My data is ASCII string with 4 characters like ‘9562’. Every character
    will show the weightage as shown in attached file. I want to use the same ASCII
    string to the input of graph for single point. Instead of HEX value (00 to FF).
    And the another help from your side can you send me the book name or softcopy of LAB
    View tutorial (Easy understandable).
    Regards,
    Azhar
    Attachments:
    data.JPG ‏79 KB

  • Show system time in Portal Header

    Hi,
    We have a requirement to display current system time/clock at the Netweaver Portal screen (preferably at the header) all time.
    How we can do that ?
    Thank you for your help in adavnce..
    Satya.

    Hi satya,
    For displaying the time in Portal header go through this document . Do some code changes based on your requirement
    [Implementing Digital World Clock on SAP Portal|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/509f3468-2e96-2c10-11b7-f15c42924272?QuickLink=index&overridelayout=true]
    hope this will helpful
    Regards
    Mahesh

  • Showing system time

    How do i sow system time on a label that changes as the time changes

    http://www.google.com/search?q=java+clock+program

  • Show current time on front panel?

    I would like to have the the current time and date displayed on the front panel. I have placed a timestamp indicator, but haven't figured out how to reset the timestamp each loop cycle. Any advice?
    I'm using LV7.
    Thanks!
    -aa

    aa.
    all you have to do if you want to show the user the time is put the getdatetime.vi in a while loop by itself in parallel with any other loops you may have. and if you have other while loops already just use a local variable of one of the other while loops for the stop condition.
    see attached vi for example of this
    Joe.
    "NOTHING IS EVER EASY"
    Attachments:
    time_stamp.vi ‏18 KB

  • How do i plot with the operating system time in one plot and show lines between cursors in another using the same XY graph?

    I am having some trouble graphing two plots at once. One plot is to show the current temperature inside a chamber as a function of time. I am trying to pick the current time and temperature each second and plot it with each point being connected by a line. I am able to show a moving, blinking dot each second but I can't figure out how to develop an actual line with these dots. To make matters worse, the blinking dot is back in the year 1903. I understand that it uses seconds elapsed since 1903, and am trying to find out how to graph the current temperature with the system time.
    The second plot is just 5 moveable cursors that are to be connected by a line. I am able to move the cursors and retrieve the position information, but I can't make a line between them.
    I have attached my main .vi, though you may have to pick the graphing part off to have it work for you.
    Attachments:
    Main Module Chamber Testing I_O every 30 sec.vi ‏288 KB

    You're not creating the XY graph data correctly. I've attached an example with a couple of simple XY Graphs. One is using a couple of shift registers to hold the spearate x and y arrays. I think this is what you were trying to do. The other one uses a VI from the shipping examples called XY Chart. It makes an XY Grpah act like a chart. I've also shown the correct way to display current time.Message Edited by Dennis Knutson on 05-12-2005 03:51 PM
    Attachments:
    XY Graph.vi ‏41 KB

  • Did they change the inventory system to have it show real time counts now?

    I ask because before it used to be that it took a store having THREE or more copies of a game or other item before they would show up as available via the website. Of course, if you looked something up using the kiosks IN store it would show most times even if it was less than three.
    I just ask because I bought a copy of Deadpool for the PS3 on Sunday and it showed as IN stock even though they only seemed to have ONE copy. By the time I got home and double checked it showed '3-5 days' for in store pickup for that same game.
    Just kind of curious since if they did improve the system this is a GREAT thing.

    Hi CheapestGamer,
    Great question about our inventory system! I always check and make sure the item I want is available before I go into the store so I don’t leave disappointed I didn’t get what that I wanted because it was sold out.
    I know that we are continuously striving to improve our systems and make them better, faster, stronger. Just recently in fact, we rolled out a new register system to the stores full of numerous improvements and upgrades. With that said, I too have noticed the system updating more quickly, and have seen exactly what you described in your post.
    Thanks for noticing our hard work, hopefully we can continue to impress!

  • Displaying system time in the stage

    I want to use the "put the time" function to display my
    system time on the stage. Can someone help?

    There are a few more formatting options using straight lingo.
    Instead
    of using "the time", you can use "the long time" which will
    show the
    hours, minutes, and seconds. Be careful though, since most of
    Director's built in ways of getting the time/date can vary
    depending on
    the user's Operating System and preferences in the control
    panel. For
    instance, some may have 24 hour time and some may have AM/PM.
    It is
    dependent upon the user's OS.
    BuddyAPI has a more configurable and controllable method, as
    Applied CD
    pointed out. That would be the best way probably.

  • How to get system time and date with PHP

    Dear Mr.Craig,
      Thanx a lot. We are running SRM 5.0 (RAMP - Implementation).
      My initial requirement is to write a server-side script to display server date and time. Could you give more inside on how to achieve it?
    Regards,
    Deva.

    Perhaps that will help.
    [code]
    <html>
    <h1>Access System time and date</h1>
    <?
         // saprfc-class-library     
         require_once("saprfc.php");
         $sap = new saprfc(array(
       "logindata"=>array(
       "ASHOST"=>"localhost"          // application server
       ,"SYSNR"=>"00"                    // system number
          ,"CLIENT"=>"000"               // client
          ,"USER"=>"bcuser"               // user
          ,"PASSWD"=>"minisap"          // password
         ,"show_errors"=>false               // let class printout errors
         ,"debug"=>false)) ;                     // detailed debugging information
         $result=$sap->callFunction("MSS_GET_SY_DATE_TIME",
            array(     array("EXPORT","SAPTIME",array()),
               array("EXPORT","SAPDATE",array())));
         if ($sap->getStatus() == SAPRFC_OK) {
        echo "Time: ".$result["SAPTIME"];
        echo "<br>Date: ".$result["SAPDATE"];
        echo "<br>or<br>";
        echo "Server is showing: "
             .substr($result["SAPDATE"], 0, 4)
             ."-".substr($result["SAPDATE"], 4, 2)
             ."-".substr($result["SAPDATE"], 6, 2)
             ." and "
             .substr($result["SAPTIME"], 0, 2)
             .":".substr($result["SAPTIME"], 2, 2)
             .":".substr($result["SAPTIME"], 4, 2);
         } else {
              $sap->printStatus();
         $sap->logoff();
    ?>
    [/code]

  • How to get System time during report generation?

    Hi,
    I am developing a template in which I am required to show data of current year only. Is there any method by which I can get system time(from which I will extract year) ?

    Thanks,
    I already have found it on page 260 of oracle bi publisher guide.
    sysdate() <?xdofx:sysdate()?> SYSDATE returns the current date and time.
    The datatype of the returned value is DATE.
    The function requires no arguments.

  • How to initialize System time?

    Hello everybody.
    I'm working with a Siemens TC65.
    I work without battery. When I supply the module, I get from System.currentTimeMillis() this value: 1009843232546, which I think corresponds to Tue Jan 01 00:00:32 UTC 2002.
    Obviously, I wish to set the correct system time.
    Does anybody knows how to set the system time?
    Thanks in advance.
    Message was edited by:
    Jordi_E

    I am experiencing the exact same problem. I am synchronising
    my time with an sntp server and setting the tc65 system time
    with AT+CCLK.
    Unfortunately System.currentTimeMillis() is still showing the old time,
    even after waiting up to 10s after AT+CCLK. So how do I get it to show
    the new correct time?
    Problem is I cannot restart the module everytime the time is set because
    I need to listen to incoming data.
    Any suggestion would be really helpful. Thanks

  • Can I print a calander without showing the times of events?

    Can I print a calander without showing the times of events. Or, alternatively, is there a way to list things without having them be an event. Just notes on the day, for instance.

    It seems like a simple solution must be at hand. There is an option in the iCal Preferences (General) panel--Show event times. With this command unchecked the screen view of the month view is free of the times of day, but when I print the month view the times of day are printed.

  • How to change the date path of Web Server to my system time?

    Hi,
    I have downloaded a Countdown SWF file from the Internet. It is working fine with the Computers which have Internet Connection. But not working without Internet connection because of the following line of code in XML file:
    <PHPurl>http://www.flepstudio.org/utilita/CountDown/gettime.php</PHPurl>
    When I opened the webpage using the above code, it shows time in a typical digits:
    Monday, October 18, 2010 9:12:52 PM in my System -shows in Web browser like : time=1287425579
    How to modify the code so that I can use my System time to work with Countdown without Internet Connection.
    The following is the path from where I have downloaded the Countdown file:
    http://www.flepstudio.org/forum/flepstudio-utilities/2960-flash-cs3-countdown.html
    Please help me to run this countdown without internet access.
    Thanks.

    It appears all that php file does is return a time=value variable.  So you need to see where that time variable is implemented in the Flash file and assign it a value using the Date.getTime() method instead of having the PHP file get called into play.  Look in the help documents or Google if you do not know how to use the Date class.

Maybe you are looking for