Guest User

Untitled

a guest
Jun 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.util.Calendar;
  3. import java.util.List;
  4.  
  5. import javax.swing.SwingWorker;
  6.  
  7.  
  8. public class Clock extends SwingWorker<Void, Void>{
  9.    
  10.     ClockUI myGUI;
  11.     private int alarm_minute;
  12.     private int alarm_hour;
  13.     private int alarm_second;
  14.     private int hour;
  15.     private int minute;
  16.     private int _alarm;
  17.    
  18.     public Clock(ClockUI gui){
  19.         myGUI = gui;
  20.        
  21.     }
  22.    
  23.    
  24.     @Override
  25.     protected Void doInBackground() throws Exception {
  26.        
  27.         while(isCancelled() == false)
  28.         {
  29.         //  System.out.println("Run thread");
  30.         this.publish();
  31.         Thread.sleep(1);
  32.         }
  33.  
  34. return null;
  35. }  
  36.    
  37.    
  38.     protected void process(List<Void> chunks) {
  39.          Calendar myTime = Calendar.getInstance();
  40.        
  41.          myGUI.setTime(myTime.get(Calendar.HOUR_OF_DAY), myTime.get(Calendar.MINUTE),  myTime.get(Calendar.SECOND));
  42.    
  43.     }
  44.    
  45.     public void setAlarm(int hour, int minute, int second){
  46.        
  47.         }
  48.        
  49.    
  50.    
  51.  
  52.  
  53.                             }
Add Comment
Please, Sign In to add comment