Unnar Björnsson wrote:Remember the (==) comparison is object comparison, it checks if the objects on both sides of the == signs are the same.
The .equals() method compares the string value of the string objects, which is what you want to compare.
Stevens Miller wrote:How long are you waiting? Looks like your code calls check if the alarm is in the future (which means you have to wait until the alarm time passes), or it adds a day to the alarm time and then calls check. Unless your alarm time starts more than a day in the past, either situation will have you waiting in check. Since your makeReady method creates a Calendar object with getInstance, and only sets the hour, minute, and second, the alarm time is always set for the current day, so you are always going to end up either waiting for that time today, or waiting for that time tomorrow.
Note that your while loop is totally compute-bound while it waits. That is, at line 54, the loop is going to run over and over, using up as much of your CPU as it can get, until the alarm time comes. That's probably not the approach you want to use.
Tony Docherty wrote:If you already have a JFrame displaying your clock you shouldn't be creating new JFrame for your snooze panel, you should be using a JDialog.
Your classes shouldn't extend Thread, they should implement Runnable.
You should call Swing methods like setVisible() on the Event Dispatch Thread.
Jan Hoppmann wrote:
sampath surineni wrote:Thanks for the reply Mr.Winston. I'm new to coding and I don't know in which folder of my project I have to include it. I'm using netbeans and there are src and libraries folders. should I include it in one of these of create a new one.
Even if I include it in one of these folders what would be its address to access.
I always put resources such as sound files or images into a resource folder named 'resources'.
Winston Gutkowski wrote:
sampath surineni wrote:I am coding an alarm application for the first time. I want to include a default tone for my application in case user did not choose a custom tone...
So you already have code to play custom tones then, yes? Just choose one of them. Alternatively, there are plenty of .wav libraries around. Download one and include it in your jar.
Google is your friend.