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 42 43 44 45 46 47 48 49 50 51 52
| public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
sched t = new sched();
}
}
public class task extends TimerTask{
/** Creates a new instance of task */
public task() {
}
public void run() {
JOptionPane.showMessageDialog(null,"Bonjour Seigneur","Info",JOptionPane.INFORMATION_MESSAGE);
//TODO generate report
}
}
public class sched {
/** Creates a new instance of sched */
public sched() {
}
public static void main(String[] args) {
Timer timer = new Timer();
Calendar date = Calendar.getInstance();
date.set(
Calendar.DAY_OF_WEEK,
Calendar.SUNDAY
);
date.set(Calendar.HOUR, 10);
date.set(Calendar.MINUTE, 10);
date.set(Calendar.SECOND, 0);
date.set(Calendar.MILLISECOND, 0);
// Schedule to run every Sunday in midnight
timer.schedule(
new task(),
date.getTime(),
1000 * 60 * 60 * 24 * 7
);
} |