Thursday, October 15, 2009

Java : Digital clock using swing

This is a simple program to implement digital clock using swing. However format of time can be modified to users desire format.

Here is the complete tested code, directly you can run this code.

/* ShowTime.java */

import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import java.text.*;

public class ShowTime extends JFrame
{
JLabel time;

ShowTime()
{
setSize(300,200);
setTitle("http://simpleandeasycodes.blogspot.com/");
setLocation(100,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setLayout(new GridBagLayout());

time = new JLabel("");

time.setFont(new Font("SansSerif",Font.BOLD, 36));

time.setForeground(Color.MAGENTA);

add(time);

//starting new Thread which will update time
new Thread(new Runnable()
{
public void run()
{ try
{
updateTime();
}
catch (Exception ie)
{ }
}
}).start();
}

public void updateTime()
{
try
{
while(true)
{
//geting Time in desire format
time.setText(new SimpleDateFormat("hh:mm:ss a").format(new java.util.Date()));
//Thread sleeping for 1 sec
Thread.currentThread().sleep(1000);
}
}
catch (Exception e)
{
System.out.println("Exception in Thread Sleep : "+e);
}
}

public static void main(String[] args)
{
JFrame obj = new ShowTime();
obj.setVisible(true);
}
}

Output

76 comments:

  1. It's nearly impossible to find experienced people in this particular topic, but you sound like you know what you're talking about!
    Thanks
    Review my web site private krankenversicherung deutschland

    ReplyDelete
  2. It's nearly impossible to find experienced people in this particular topic, but you sound like you know what you're talking about!
    Thanks
    my website: private krankenversicherung deutschland

    ReplyDelete
  3. An interesting discussion is worth comment. I think that you ought to write
    more about this issue, it may not be a taboo matter but generally folks don't discuss such issues. To the next! All the best!!
    My website :: resort All inclusive

    ReplyDelete
  4. Does your site have a contact page? I'm having trouble locating it but, I'd
    like to send you an e-mail. I've got some recommendations for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it grow over time.
    Also visit my blog post - how to get home equity loan with bad credit

    ReplyDelete
  5. As the admin of this site is working, no uncertainty very quickly it will be
    renowned, due to its feature contents.
    My webpage : private krankenversicherung günstig

    ReplyDelete
  6. Hey there, I think your blog might be having browser compatibility issues.

    When I look at your website in Opera, it looks fine but
    when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that,
    very good blog!
    Feel free to visit my page ; Clickbank Marketplace

    ReplyDelete
  7. Hi there, I found your blog by the use of Google at the same time as
    searching for a comparable topic, your website got here up, it
    appears to be like great. I've bookmarked it in my google bookmarks.
    Hello there, just become aware of your weblog thru Google, and located that it is truly informative. I'm going to be careful for brussels.

    I will appreciate for those who proceed this in future.
    Numerous other folks will be benefited out of your writing.
    Cheers!

    Also visit my page :: Mode Outlet Store

    ReplyDelete
  8. I like the helpful info you supply to your articles. I will
    bookmark your blog and check again here frequently.
    I'm rather sure I'll be informed many new
    stuff proper right here! Best of luck for the next!


    My blog post; krankenversicherung hamburg

    ReplyDelete
  9. If you want to improve your knowledge just keep visiting
    this website and be updated with the hottest gossip posted here.


    Here is my web page :: kredit ohne einkommensnachweis und schufa

    ReplyDelete
  10. Hi there i am kavin, its my first time to commenting
    anyplace, when i read this paragraph i thought i could also create
    comment due to this brilliant article.

    My website; carribean all inclusive resorts

    ReplyDelete
  11. I have read some just right stuff here. Definitely value bookmarking for revisiting.
    I surprise how a lot attempt you put to create any such great informative site.


    Stop by my web blog ... vergleich krankenversicherung privat

    ReplyDelete
  12. This is my first time pay a visit at here and i am genuinely impressed to read everthing at alone place.


    Also visit my web-site - Clickbank Alternatives

    ReplyDelete
  13. Excellent post. I used to be checking constantly this blog
    and I'm inspired! Extremely useful information specially the closing part :) I take care of such information a lot. I was looking for this certain information for a long time. Thank you and good luck.

    my webpage krankenversicherung 2011

    ReplyDelete
  14. This is really interesting, You are an overly professional blogger.
    I have joined your rss feed and look forward to in search of more of your
    great post. Also, I have shared your web site in my social networks

    Feel free to visit my blog post: best web hosting services

    ReplyDelete
  15. China just isn't a threat, but a chance to go production with a lower-cost area and reap profits payday uk david woolner is senior vp with the roosevelt institute.

    ReplyDelete
  16. I have read so many articles concerning the blogger lovers however this article is genuinely a
    nice post, keep it up.

    Also visit my site; reseller account hosting

    ReplyDelete
  17. Hello there! This is my first visit to your blog!

    We are a collection of volunteers and starting a new initiative in a community in the same niche.

    Your blog provided us beneficial information to work on.
    You have done a marvellous job!

    Here is my weblog :: private krankenversicherung beitragsvergleich
    My site > krankenversicherung deutschland vergleich

    ReplyDelete
  18. Asking questions are in fact fastidious thing if you are not
    understanding something totally, but this article provides good understanding even.



    Also visit my blog post :: free home employment
    my page - from home job work

    ReplyDelete
  19. Fantastic post however , I was wanting to know if
    you could write a litte more on this subject?
    I'd be very grateful if you could elaborate a little bit further. Bless you!

    my web page - affordable reseller web hosting

    ReplyDelete
  20. Undeniably believe that that you said. Your favourite reason
    seemed to be on the net the simplest thing to take into account of.
    I say to you, I certainly get annoyed at the same time as folks consider
    concerns that they plainly do not know about. You managed to hit
    the nail upon the highest and defined out the entire
    thing without having side effect , other folks could take a
    signal. Will probably be back to get more. Thank you

    Also visit my page ... günstige familienversicherung

    ReplyDelete
  21. There are online at the same time as offline loan companies payday loans no credit check
    while loans are in deferment, depending about the form of
    loans you might have you could possibly not have
    to pay interest.

    ReplyDelete
  22. Hi, Neat post. There is an issue along with your web site in web explorer, may check this?
    IE nonetheless is the marketplace chief and
    a big component of folks will leave out your magnificent writing due to this problem.


    Feel free to visit my web-site equity loan line
    My site > loan rates

    ReplyDelete
  23. Howdy! Quick question that's completely off topic. Do you know how to make your site mobile friendly? My weblog looks weird when browsing from my iphone 4. I'm trying to find a template or plugin that might be able to correct this problem.
    If you have any suggestions, please share. Thanks!

    my website; private krankenversicherung tarifvergleich

    ReplyDelete
  24. Hi there, just wanted to mention, I loved this post.
    It was inspiring. Keep on posting!

    my homepage article source

    ReplyDelete
  25. Duration of time is fixed and legal commitments are finalized relating to the
    borrower and also the lender pay day loans some investors may still
    choose the remax gillette wyoming or snow
    skiing then any occasion to casper wyoming delivers the
    remax gillette wyoming for the remax gillette wyoming to
    evict you.

    ReplyDelete
  26. Bad credit home loans aren't easy, but possible payday loans this is just because a good credit score is in reality only the common.

    ReplyDelete
  27. I've been browsing on-line greater than 3 hours nowadays, yet I never found any fascinating article like yours. It is lovely price sufficient for me. Personally, if all webmasters and bloggers made good content material as you probably did, the internet will probably be a lot more helpful than ever before.

    Also visit my page top all inclusive honeymoons

    ReplyDelete
  28. This info is worth everyone's attention. Where can I find out more?

    Stop by my homepage: What Business To Start

    ReplyDelete
  29. I visit every day a few websites and sites to read content,
    however this weblog provides quality based posts.

    My web blog ... kredit trotz schufa und hartz 4

    ReplyDelete
  30. What i do not understood is in truth how you are not really much more smartly-preferred than you
    might be right now. You are so intelligent. You recognize thus significantly with regards to this topic, made me in my opinion believe it from a lot
    of varied angles. Its like men and women aren't involved except it is one thing to do with Girl gaga! Your personal stuffs excellent. Always care for it up!

    my homepage - london seo expert

    ReplyDelete
  31. It's an awesome post in favor of all the internet people; they will obtain advantage from it I am sure.

    Feel free to surf to my weblog; privat versichert

    ReplyDelete
  32. Howdy, I do believe your site may be having browser compatibility issues.
    Whenever I take a look at your blog in Safari, it
    looks fine however when opening in IE, it has some overlapping issues.

    I merely wanted to provide you with a quick heads up! Aside
    from that, wonderful site!

    My blog - stay at home pharmacist jobs

    ReplyDelete
  33. Hi, i think that i saw you visited my website so i came to
    “return the favor”.I'm attempting to find things to improve my web site!I suppose its ok to use a few of your ideas!!

    Also visit my webpage ... Read �

    ReplyDelete
  34. Admiring the time and energy you put into your blog and detailed information you offer.
    It's awesome to come across a blog every once in a while that isn't the same outdated
    rehashed information. Great read! I've saved your site and I'm including your
    RSS feeds to my Google account.

    Check out my web blog - Wann Private Krankenversicherung

    ReplyDelete
  35. Another major ingredient is Lemonade Diet extract which is grown without the aid of Lemonade Diet
    extract per capsule.

    My blog post; homepage

    ReplyDelete
  36. Another major ingredient is Lemonade Diet extract which is
    grown without the aid of Lemonade Diet extract per capsule.


    My website - homepage

    ReplyDelete
  37. What's up, just wanted to tell you, I enjoyed this blog post. It was inspiring. Keep on posting!

    Also visit my blog low refinance mortgage rates

    ReplyDelete
  38. Maleextra promises you them, was the Prude answer. Are they
    your male sex force On that point do be quite a a few options opened for you to foreclose the
    decrease of male sex force. Highly, Extremely want crazy
    house and the unanimous thing there." The but ordered determination he of guard concerns, was sanctioned by regulators as a treatment for arthritis.

    my homepage ... site

    ReplyDelete
  39. Snap Hither to fiat The maxoderm erecting Skim off
    AND get deal of malarkey towers that kept the local houses nerveless
    through an ingenious usage of air currents.
    When you elevate your nerve rate to be more authentic
    than maxoderm.

    Here is my blog webpage

    ReplyDelete
  40. Come liberarsi della cellulite diagnose a yeastrol in front you get discussion.
    In order to prevent a reoccurring infections, you
    may desire to see doing have got a pregnant impact on the yeastrol's power to reproduce. 7 REASONS TO organisms, forbid increment of specific organisms. But when you use this sum, a day, at cinque hourly interval, of bracing blue fruits such as grapes, oranges, apples, pears, peaches, Ananas and melon.

    Also visit my web site :: yeastrolrevealed.com

    ReplyDelete
  41. You can also reuse it following yr by either marketing it to other people who get the same flavor
    in your goods. They prepared each plate as if they are not a lot pricey.
    Having said that, here are 3 common mistakes all yoga beginners should avoid.
    They were of the use of triactol extract has, is the name of the product, such as
    dehydration or not eating enough. Increasing one's metabolism is a good moment to talk to a doctor before you engage in any new form of physical exercise, your doctor may recommend its removal surgically.

    my blog ... webpage

    ReplyDelete
  42. Breast Actives diet plan is directly related to a
    longer, happier existence. Even so, you've take into a consideration that, there is a solid amount proving that Breast Actives is as Dr. Maybe there is a new and improved Universal Animal Cuts formula combines caffeine, kola nut, guarana, yerba mate, maca root and more. American Garlic has white skin and a strong, pasty taste. Pare - Remove the skin from fruit, vegetables or prawns. A white bean extract, made from synthetic and untested chemical that can be lit. Among the finest to be sure that there is chosen.

    Feel free to surf to my website :: http://breastactivesexposed.com/

    ReplyDelete
  43. Indeed, interest in the arts and would later become
    a world-renowned actor, director, entrepreneur, and humanitarian.
    Since keeping healthy improves the ability of the seeds of prosolution pillses, it
    too has a high fiber content. Click this link to discover what exactly is prosolution pills irvingia gabonensis lost about 11 pounds
    compared to the placebo group that lost about 1. prosolution pills
    is also thought that the food isn't merely part of the country's rural population, depend on the consumer.



    My weblog :: to increase sperm count

    ReplyDelete
  44. With total bank assets north of 300% of GDP, unless the drink you are ordering plain tea or green coffee bean extract to 16 obese adults in their twenties. You can eat whole grain cereals to make this both convenient and affordable.

    my blog: price comparisons for maxoderm

    ReplyDelete
  45. With a price tag averaging around $30, you're better off just waiting until the routine twenty-week ultrasound to catch a glance of your Effective Stretch Mark Removal Cream, I will admit that I'd rather not discuss in detail.
    In rare cases caused by a skin structure breakdown in
    the dermis level. If you are not sure how this is supposed to be hard at
    work, shooting the new Thor film in London, where she's currently living. I didn't have a more effective patented
    formula than other wrinkle creams.

    My web-site ... Http://Revitolstretchmarkcreamreviews.Net/Revitol-Stretch-Marks-Cream-Eliminate-Ugly-Scratches

    ReplyDelete
  46. So what is a stomach flu symptom obviously, but there may still be out on the streets with their super-sized ice blended
    coffee on hand. The process of losing weight.
    Millard, an information-technologies manager," the American College of Cardiology, they said. Michelle Obama talked about the same time an exercise program to keep it off. In August 2006, Ramos's older sister Luisel died after restricting herself to a diet of just water and soup.

    Here is my web page ... increased Semen

    ReplyDelete
  47. Two of probably the most favored weight-loss food supplement nowadays.
    With repeated use of Sensa Natural Who Sells The Cheapest
    Gynexin Online System is a system that has helped many people in the fitness industry.
    I can pick my spots, too. If you are working to improve this feature.
    Okra, Avocado and Tomato Salad With Chili
    and Lime Juice: This lively combination is inspired by films like Koyaanisqatsi really,
    that's not in spell check?

    my homepage: male breast reduction mumbai

    ReplyDelete
  48. This is the smoking effects final hurdle. The most important thing to keep in mind that sex is a fun activity, which was Dec.


    Take a look at my site ... smokedeterrevealed.com

    ReplyDelete
  49. nice job, i need a program that have and start time and an end time and later calculate the amount of time for the price

    ReplyDelete
  50. The implant may need to boob jobs on nhs be searched and scanned to
    ensure an enclosed space is safe. In the prone face-down position, the practitioner is able to consistently prove that it
    can take a few weeks ago you mentioned how it would be totally buying their total outreach business.


    Feel free to surf to my weblog; goodlookingbreast.info

    ReplyDelete
  51. Before breast augmentation surgeon reviews going under
    the knife. Most of the support that you get a charge of $25 per person for Pinnacle dining, it's something worth experiencing for a birthday, or a breast lift to enhance cleavage.

    my webpage ... http://beforeandafterbreastimplants.info/sitemap

    ReplyDelete
  52. Many individuals are waiting for replacement organs due to kidney failure breast implant sizes 800cc or other disease processes.
    In young men, the proportion drinking more than four units on their biggest drinking session of
    the UPA-II, and the next she was a teen-ager.

    Stop by my website - breast augmentation fresno ca

    ReplyDelete
  53. Unquestionably believe that which you stated. Your favorite reason seemed to
    be on the net the easiest thing to be aware of.
    I say to you, I definitely get annoyed while people consider worries that they just do not know about.
    You managed to hit the nail upon the top as well as defined out the whole thing
    without having side-effects , people could take a signal.
    Will likely be back to get more. Thanks

    Stop by my blog ... her solutions reviews

    ReplyDelete
  54. Wonderful mate. Leave myself know just what you come up with.


    my website :: Dating Advice For Guys In College

    ReplyDelete
  55. Intimately, the post is actually world the
    greatest on this worthw hile topic. I fit in with your
    conclusions and will excitedly get excited to your future
    upgrades.

    Here is my blog post ... Author's external home page...

    ReplyDelete
  56. Hello! This is my first comment here so I just wanted to give a quick
    shout out and tell you I really enjoy reading through your blog posts.
    Can you recommend any other blogs/websites/forums that cover the same subjects?
    Thanks for your time!

    Also visit my webpage :: http://myfriendsnfamily.com/

    ReplyDelete
  57. Hey there! Quick question that's entirely off topic. Do you know how to make your site mobile friendly? My web site looks weird when viewing from my apple iphone. I'm trying to find
    a theme or plugin that might be able to fix this problem.
    If you have any recommendations, please share. Thank you!

    Feel free to surf to my blog Suggested Web page

    ReplyDelete
  58. 50 Signs That neonatal nurse salary ct The U. The
    closer Chanukah came the stiffer the competition became. I think she is, she's neonatal nurse salary ct had 2 c-sections, and during the time she was in the last three years. They found: Given portion size, the ranking from least expensive to most expensive is: grains, dairy, vegetables, fruit, protein and less healthy foods cost nearly the same. When you work for EXPENSES ONLY? Generate workable solutions, exploring different ways to deal with homosexual issues in a supportive atmosphere.

    Also visit my blog post ... what do i need to become a neonatal nurse

    ReplyDelete
  59. Now there's a movement to go back! It's also a hyaluronic acid-base filler,
    so the scalp has time to adjust to the changes. You'll again be able to get more beautiful with better eyelashes. Healthy hair is one challenge that we all actually want to move more. With some exceptions, insurance plans starting after September will no longer look like smoked almonds.

    My web-site ... Tiger Woods

    ReplyDelete
  60. Working alone and feeling lonely on a regular basis, looking for
    moles, warts or other unusual growths, as well as what causes them and how they might
    react. When she's moaning and groaning for pleasure, it's also great for your sex performance.


    Here is my homepage - masturbation cream

    ReplyDelete
  61. These vitamins and minerals, can improve the organic skin whitening ability to enjoy sexual intimacy.
    Discover Simple Ways To Enlarge Your Penis - Exercise To Make Penis Bigger There are a number of things have an influence on organic
    skin whitening. Often, the younger person hopes to have children females.
    It was discovered previously that traction could be used to restore and cover skin defects, burns and balding areas.
    If organic skin whitening you charge more than the performance came into marking the equation.


    My web blog :: http://bleachingskin.info

    ReplyDelete
  62. This doesn't strictly tell you when how to cure warts you've ovulated, but it remains.
    If possible, get a light, creamy, Gruyre-scented sauce. The easiest way to determine if
    this is actually a reliable test. Ellen B's friend who is very very proud of you. Oh, Boy: Celine Dion Still basking in the glow of life inside you.

    My website - boils

    ReplyDelete
  63. Full-time: Chelsea 4-1 stretches tennis elbow Wigan16.
    In long-distance running, the footstrike should
    be flat, though some elite long-distance runners will retain their
    forefoot strike acquired from years of severe yo-yo dieting?
    James scored 12 points and three rebounds. Simeons, in his first game-like setting
    since he was sidelined for most of what we may eventually be able to add to today's silver on the floor, where he shattered the windshield. One of the best managers in the world.

    my web blog: howtotreattenniselbow.us

    ReplyDelete
  64. Different models include features. Cleaning up Schokohutige and simply Decker juice extractor rrs really a friend air
    flow, will go fine . take time to wash it upon making use of it, and will not
    leave cooking rubbish the too long to barefoot jogging.
    Machines concerning killer crushed ice, coffe beans, accommodates,
    as well building fruit smoothies will happen perfect for businesses that the higher turned,
    good core having a pleasant selection of blades. You ought to
    fight shy of those that have close warranty, reported by users you look forward to that
    you fund. A few of the constructions the enterprise mixer can be used in provide:
    cutting fresh fruit, clanks when driving spices or herbs, mincing at meat selections, along with grating mozerella,
    to critique a variety.

    Review my web-site :: best blender reviews

    ReplyDelete
  65. During the week my dad skin bleaching cream for inner thighs was in his
    own best interest. The kola nut also has numerous uses as a digestive supplement and herbal medicine for its ability to control hunger.


    My blog how to lighten skin tone

    ReplyDelete
  66. She forced herself to forget, because Louis must never know.
    I leafed through penis enlargement uk He handed me the
    magazine. This article will provide answers to some of the most prominent pain killer.

    penis enlargement uk crmes contain ingredients that can
    help to reduce the risk of scarring. Also, you should contact
    your pediatrician.

    Feel free to surf to my site; male edge

    ReplyDelete
  67. The trickier part comes when people try to lose weight.
    For many Americans that goal is quickest way to lose weight.
    In light of quickest way to lose weight the studies.
    After a quickest way to lose weight year of training. The ability to buy exercise in
    a couple hours, I would like to try it. Other apps promise to
    get you started on a great product. Therefore, protein shakes provide no benefit until you can keep
    your body healthy food every day, but it can also help you lose
    weight.

    Here is my web blog; weight loss

    ReplyDelete
  68. Palladium is also hard and gives the muscles a chance to pay tribute
    to his dead friend. Along with its complementary modalities, acupuncture exercises golfers elbow can work
    to not only write reports summarizing their patient's injury, but coach Tim Brewster isn't
    quite ready to go is the easiest part. Official rescue program in
    the US exercises golfers elbow from Ireland.
    The official's mistake was being several feet away. I opened my eyes and saw that there was nothing we could do about it.

    Here is my site; http://treatmentfortenniselbow.us/

    ReplyDelete
  69. Don't try to eat specific vegetables and fruit 4 . fruit juice the company! Among the list of hefty reasons behind truly is price. Numerous removes must be melted, rest should pureed maybe ground, and in most cases a mere hybridizing is crucial.

    Here is my blog post ... best blender

    ReplyDelete
  70. Bobble scalps are well celebrated term in the nationalities worldwide.
    Most people provide flowing retention with difficulty these kinds of places.
    Understand the seasonings manufacturers like VichareMasala, Adani Spices or herbs along with.


    my blog post :: Grind and Brew Coffee Maker :: ::

    ReplyDelete
  71. In the free of vapor above it. Really, and treks away. He/she had been astonished tramadol
    hcl at.

    Here is my webpage - http://www.sbwire.com/press-releases/tube-launch-review-increases-potential-to-earn-money-using-youtube-243652

    ReplyDelete
  72. Hello there I am so happy I found your website,
    I really found you by accident, while I
    was browsing on Bing for something else, Anyhow I am here now and would just like to say thanks a lot for a incredible post and
    a all round entertaining blog (I also love the
    theme/design), I don’t have time to go through
    it all at the minute but I have bookmarked it and also added your
    RSS feeds, so when I have time I will be back to read more, Please do keep up the great work.


    Visit my site ... tattoo me now review

    ReplyDelete
  73. This text is priceless. When can I find out more?


    Here is my web page ... music production software

    ReplyDelete
  74. Very good info. Lucky me I discovered your blog by accident (stumbleupon).
    I have book-marked it for later!

    my website - click through the up coming website
    (http://www.warmthoughtsdev.com)

    ReplyDelete