Не сте регистриран! Регистрирайте се БЕЗПЛАТНО, за да използвате услугите на сайта!

 Аларма
Автор  iwanov (28.01.2008 22:35) съобщение до автора
Погледнат  1469 пъти добави към любими
Оценка добави коментар
Гласове  4 изпрати на приятел
Коментари  (2) абонирай се за Java
     
iwanov
     
 

CODE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.*;
import java.io.*;
import sun.audio.*;

public class AlarmProgram {
    
static int ahour = 1; //Hour of alarm
     static int
aminute = 1; //Minute of alarm
     static int
asecond = 1; //Second of alarm
     static int
aampm = GregorianCalendar.AM; //AM/PM of alarm
     static
String filename = "alarm.wav"; //Filename of alarm sound
    
     public
static void main (String[] args){
         
new Thread(new thr()).start();
    
}
    
    
static class thr implements Runnable{
         
public void run(){
              
try{
                   
int al = 0;
                   
while (al == 0){
                       
//Get actual times
                         int
hour = new GregorianCalendar().get(GregorianCalendar.HOUR);
                        
int minute = new GregorianCalendar().get(GregorianCalendar.MINUTE);
                        
int second = new GregorianCalendar().get(GregorianCalendar.SECOND);
                        
int ampm = new GregorianCalendar().get(GregorianCalendar.AM_PM);
                        
                       
//Do we need to sound the alarm?
                        
if (ahour == hour && aminute == minute && asecond == second && aampm == ampm){
                             
InputStream in = new FileInputStream(filename);
                             
AudioStream as = new AudioStream(in);
                             
AudioPlayer.player.start(as);
                             
al = 1;
                        
}
                        
                        
Thread.sleep(1000);
                   
}
               }
              
catch (Exception err){}
          }
     }
}



Ключови думи: Java аларма




 За автора: iwanov  
Казвам се Галин Иванов и обичам да се занимавам с програмиране и като цяло с компютри. Разбирам от HTML, CSS, PHP и MySQL. Старая се да научавам постоянно нови неща от IT сферата.
   
 1 посетител чете този скрипт (0 потребители и 1 гост)  
Активни потребители: ---
   
  

Еmail  
 

Нямам цел.

  iwanov на 02.02.2008 14:39

http://www.dreamincode.net/code/snippet1097.htm
Това ли е целата? Да извлечеш всички скриптове по другите сайтове?

  PureEvil на 02.02.2008 12:30

 

 
  • Интересно от Софтуер
 
  • Интересно от myLINKS
 
 
 
 



IT-PLACE.NET © 2004 - 2008