Current location: Hot Scripts Forums » Programming Languages » Everything Java » Alarm clock program with Java


Alarm clock program with Java

Reply
  #1 (permalink)  
Old 10-09-07, 02:18 PM
Nacer Nacer is offline
New Member
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Angry Alarm clock program with Java

Hello,

I am trying to make an Alarm clock program using Java.
I need some one to help me to start please or if any code source available in the net.
Thank you.
Reply With Quote
  #2 (permalink)  
Old 05-13-08, 09:34 AM
Mr.coder Mr.coder is offline
New Member
 
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Ready To Program

if u are working with ready to program here is the code,,

java Code:
  1. import java.applet.*;
  2. import java.awt.*;
  3. import java.util.*;
  4. public class ClockApplet extends Applet implements Runnable
  5. {
  6.  
  7.  Thread goThread;
  8.  
  9. static Image doubleBufferImage; // the hidden buffer
  10.     static Graphics doubleBufferG;
  11.  
  12. public void init ()
  13.     {
  14.         goThread = new Thread (this);
  15.         goThread.start ();
  16.         }
  17.  
  18.  public void update (Graphics g)  //update does the dubble buffering.
  19.     {
  20.         if (doubleBufferImage == null) // if this is the first time, create the buffer
  21.         {
  22.             doubleBufferImage = createImage (this.getSize ().width, this.getSize ().height);
  23.             doubleBufferG = doubleBufferImage.getGraphics ();
  24.         }
  25.         doubleBufferG.setColor (getBackground ()); // clear the screen
  26.         doubleBufferG.fillRect (0, 0, this.getSize ().width, this.getSize ().height);
  27.         doubleBufferG.setColor (getForeground ()); // draw to the hidden buffer
  28.         paint (doubleBufferG);
  29.  
  30.         g.drawImage (doubleBufferImage, 0, 0, this); // move the hidden buffer to the screen
  31.     }
  32.  
  33.  
  34. public void run ()
  35.     {
  36.         while (Thread.currentThread () == goThread)
  37.         {
  38.             repaint ();
  39.         }
  40.  
  41.     }
  42.  
  43. public void paint (Graphics g)
  44.     {
  45.         Date d = new Date (System.currentTimeMillis ());
  46.         g.drawString (d.getHours () + ":" + d.getMinutes () + ':' + d.getSeconds (), 10, 10);
  47.  
  48.    }
  49. }
And that is it and tell Mr.Kurz i said hi

Last edited by Nico; 05-13-08 at 02:44 PM. Reason: Wrappers.
Reply With Quote
  #3 (permalink)  
Old 10-08-10, 12:16 AM
Bushman Bushman is offline
New Member
 
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Alarm clock in Java

I'm building and alarm clock also in bluej. is this the right code??
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Tree Program (Simple) Chloe Job Offers & Assistance 1 05-03-06 02:38 PM
need some help troubleshooting a java program... PupilEX Everything Java 2 10-07-05 04:41 AM
e-Zest Joins Sun iForce Partner Program ezest General Advertisements 0 03-21-05 10:33 PM
how to restart the system using java program forsrinivasan Everything Java 2 09-24-04 09:48 AM
New to Java - First "real" program! renderstream Everything Java 0 03-17-04 09:54 AM


All times are GMT -5. The time now is 05:43 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.