Hi @GregBrannon Its been awhile! You requested I post the latest code; fortunately i've solved "The Problem". It turned out that the designer (JiGloo) i was working with had a serious beef with me! So here it is:
/**
*
*/
package logRemainder;
import javax.swing.JOptionPane;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
import gui.CreateLogRemainder;
/**
* @author aknessy
*
*/
public class RemainderBeep{
private Timer timer;
private Toolkit toolkit;
private int time;
private static int numOfBeeps = 10;
private javax.swing.Timer swingTimer;
private CreateLogRemainder fm = new CreateLogRemainder();
public void Beep(){
timer = new Timer();
toolkit = Toolkit.getDefaultToolkit();
Calendar calendar = Calendar.getInstance();
/**
* Get The Time...
*/
String getCloseTime = JOptionPane.showInputDialog(null, "<html><body><font color='green'>"
+ "Please Enter Today's Closing Time: </font><br>"
+ "<font color='red'><p align='center'> 1 - 24HRS!</p></font>");
time = Integer.parseInt(getCloseTime);
/**
* Use The collected time with a Calendar Instance
*/
calendar.set(Calendar.HOUR_OF_DAY, time);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Date time = calendar.getTime();
timer.schedule(new RemainderTask(), time, 1*2000);
/**
* A Swing Timer To Display
* The MessagePanel
*/
swingTimer = new javax.swing.Timer(1000, new swingTimerListener());
swingTimer.setDelay(40);
swingTimer.setCoalesce(true);
swingTimer.setRepeats(false);
swingTimer.start();
}
/**
* This Remainder Class counts down to zero,
* and sets a Toolkit object to beep during
* this count-down.
*
* If the count-down is equal to zero,
* stop the java.util.Timer, stop the swing timer
* and dispose the MessagePanel.
*/
class RemainderTask extends TimerTask{
public void run(){
if(numOfBeeps > 0){
toolkit.beep();
numOfBeeps--;
}else{
toolkit.beep();
timer.cancel();
swingTimer.stop();
fm.dispose();
}
}
}
public static void main (String[] args){
new RemainderBeep().Beep();
}
class swingTimerListener implements ActionListener{
public void actionPerformed(ActionEvent ae){
fm.TestFadeLabel();
}
}
}