Why won't get(Calendar.MINUTE) work?????

I am a beginner programmer and am writing some code for my theater company to help our operations in the lighting booth. I want it to pop up a message box at a certain time, say 7:55 pm, that will tell the stage manager to give the actors their 10 minute call. I have tried the following:
int a = calendar.get(Calendar.HOUR_OF_DAY);
int b = calendar.get(Calendar.MINUTE);
while(a==19 && b!=55)
int i = 0;
for(i=0; i<6; i++)
b = calendar.get(Calendar.MINUTE);
JOptionPane.showMessageDialog(null, "Call 10 minutes.");
I have also tried many other things, such as just putting while(calendar.get(Calendar.HOUR_OF_DAY)==19 && calendar.get(Calendar.MINUTE)<55);. Nothing has worked. What appears to me to be happening is that the method get(Calendar.MINUTE) is not updating itself as time changes after the initial run of the statement (I derived this from de-bugging and watching the values change.) Is there any reason for this? Does it just not recognize the finite time change from one minute to the next in the middle of running? Are there any solutions? Thank you!
Addendum: There are no errors in the IDE (Netbeans)
Edited by: cubswar on Mar 25, 2008 5:18 PM

cubswar wrote:
What appears to me to be happening is that the method get(Calendar.MINUTE) is not updating itself as time changes after the initial run of the statement That's correct. A Calendar object doesn't magically update itself as time passes. It's just a representation of an instant in time and certain culture-imposed divsions and labels for that instant.
If you want a Calendar that reflects the time 5 minutes later, then 5 minutes later, you have to create a new Calendar. (Or explicitly set an existing Calendar to that time.)
Also, why would you think this:
for(i=0; i<6; i++)would take a minute or more? It probably takes a few microseconds at most, and quite probably only a fraction of that.
If you want something to happen at a certain time, use Timer and TimerTask, or just do a Thread.sleep for the requisite time. (The easiest is probaly [http://java.sun.com/javase/6/docs/api/java/util/Timer.html#schedule(java.util.TimerTask, java.util.Date)].)

Similar Messages

  • I have the old iPad and would like to know why I cannot get Skype to work on it.I can get to ring the number but the person cannot here me.

    I have a old iPad and would like to know why I cannot get Skype to work.I can get it to ring the number but when the person answers they can't here me why is this.

    Based on Skype's website, are you using a compatible headset?

  • Why won't my iTunes code work

    Why won't my iTunes code work helpppp

    Hi Benrad09,
    If you are having issues redeeming an iTunes Gift code, you may find the following article helpful:
    Apple Support: If you can't redeem your iTunes Gift Card or code
    http://support.apple.com/kb/HT6021
    Regards,
    - Brenden

  • Why am I getting calendar events twice?

    Why am I getting calendar events twice on my iPhone? I am sharing calendar with my wifes iPhone. My duplicates code in the same color, my wife gets duplicates in different colors.  I suspect this is a set up problem but help here would be appreciated.

    I figured it out.  It has to do with which calendars you want displayed.  Duplications come from multiple calender selections.

  • Why won't canon lens fully work in autofocus.?

    Canon lens 28-105mm attached to 5dmarkiii body will not always work in auto focus mode. I think I can occasionally get it to work in alfocus but even in manual the lens occasionally won't register focused objects. Do I have a problem with the lens or do I need to change a setting somewhere to get the camera to know what lens is on it?

    JonKline wrote:
    Assuming you have the switch on the lens set to AF, and the camera set to use AF, that's all you should need to do.
    I would suggest you send your lens in for servicing.
    Ah, this thread brings back memories. The 28-105 was my first lens on my first DSLR. I still have it, though it now resides on the sparest of my spare cameras (the one that goes to the first grandchild that shows any interest in a camera that's not part of a cell phone). It's not nearly as bad as Ernie Biggs makes it out to be, and I got some good pictures with it. But if it broke, I wouldn't pay actual money to have it serviced.
    And I wouldn't dream of insulting my 5D3 by using that lens on it.
    Bob
    Boston, Massachusetts USA

  • Why cant I get itunes to work in windows 8? I hate this  update issue nothing works- aggh!

    Why cant I get itunes update to work in windows 8?
    I tried running the new itunes installer since it couldn't update itunes, then I tried the installer with
    compatability checked. The older version worked fine till an update came out and now nothing works
    (sync /app updates/ photo uploads)- it does still play music on the computer.
    My son had older (windows 7) computer but if I sync there it tells me I'm wiped and stuck with his music.
    I'm really hating itunes and ready to trash the phone etc. Im due for upgrade anyway.
    With all these stupid upgrades why hasn't this issue been addressed. 8 has been out for awhile now.
    Has anyone been able to fix this issue? Please share how!

    You will need iTunes 9.2.1 at minimum to access the iTunes Store. Earlier versions will not work.
    http://support.apple.com/kb/DL1056
    but it would be best to upgrade to Mac OS X 10.5 or 10.6, since it's probable that eventually the iTunes Store will no longer support iTunes 9.x. and newer versions of iTunes will not run on Mac OS X 10.4.
    Regards.

  • HT4972 Why won't Kindle or instagram work on my I-Touch? Why do either of them require IOS 4 or 5?

    Why won't Kindle or instagram Apps work on my I-Touch?
    Why do either of them require IOS 4 or 5 and why can't Itouch V2 update to IOS 4 or 5 operating systems?

    1. The developer stopped supporting older iOS versions.
    2. A second generation iPod touch can be updated to iOS 4.2.1 but doesn't have enough RAM to run iOS 4.3 or newer.
    (82591)

  • WHY WON'T STICKY KEYS ACCESSABILITY WORK ON SAFARI/

    WHY WON'T STICKY KEYS ACCESSABILITY FEATURE WORK ON SAFARI? I AM A DOUBLE AMPUTEE AND THIS FEATURE REALLY HELPS ME.
    RANDY

    Do us all a favor, and unlock your Cap keys.  It's considered yelling, and it's a real turn-off for those looking to help posters here.

  • Why won't my lock button work?

    I went to lock my iPod and my lock button won't work. I can't even push it down, it's like stuck down in the hole but it won't pop back up. Everything works fine but I have to wait for it to auto-lock everytime I want to turn it off. Why won't the button pop back up?

    It looks like you have a hardware issue. I don't know why the button doesn't pop up, but You can enable assistive touch. Assistive touch gives you a virtual lock button, so that will solve you problem. You can enable it by going to Settings->General->Accessibillity->AssistiveTouch->On.

  • Why won't my "if" expression work?

    This calculation works:
    IF(A3<1,A3*10,IF(A3<5,20))
    Why won't this one:
    if(A4<1,B4==0,if(A4>1<=2,40,if(A4>2<=3,60,if(A4>3<=4,100,if(A4>4<=5,125)))))
    If you want me to send you the table that I am trying to make this work in, just let me know. Thanks,
    Elaine.

    Never mind, I figured it out! Whew.

  • Why won't megapack for iworks work on my mac?

    Why won't my megapack for iworks work on my macbook pro?

    only pages will work and its crap...what a waste of money.

  • Why won't time capsule router work?

    Why won't the time capsule's wireless router work to allow internet access?  Just got it, new 2 tb!  Lost the excitement of it all now!  Help!  Connecting to new MacBook pros (13" &amp; 2X15"s) as well as a Toshiba laptop.  Followed all the directions and backed up just fine, but have not been able to browse web at all with this crap!

    You do not have to load the airport utility.. a newer version is already included on the computer.
    Just go to the applications / utility directory and start airport utility.

  • Why won't combined AND statement work

    I want to exclude records based on two criteria's: status = 'M' and the status reason = 52.
    The table contains records with status = 'M' and status reason other than 52.
    Also the table contains records with status other than 'M' and status reason = 52 and I want to include those records.
    I first tried using the statement below reasoning that placing the two criteria's in parenthesis would combine them and only exclude records with M 52
    Where (nvl(Status_CD,'A') <> 'M' AND nvl(STATUS_RESN_CD,0) <> 52 )
    However the query removed all records with Status_CD 'M' and all records with Status_Resn_CD 52. 
    Using the Where Not statement worked.
    Where Not (External_Status_CD = 'M' and EXT_STAT_RESN_CD = 52 ) 
    I’m curious why the first statement didn’t work?
    Can anyone explain why the first query didn't combine the 2 statements but a Where Not did?
    Thank you - Mark

    HI, Mark,
    markjames9 wrote:
    I want to exclude records based on two criteria's: status = 'M' and the status reason = 52.
    The table contains records with status = 'M' and status reason other than 52.
    Also the table contains records with status other than 'M' and status reason = 52 and I want to include those records.
    I first tried using the statement below reasoning that placing the two criteria's in parenthesis would combine them and only exclude records with M 52
    Where (nvl(Status_CD,'A') <> 'M' AND nvl(STATUS_RESN_CD,0) <> 52 )
    However the query removed all records with Status_CD 'M' and all records with Status_Resn_CD 52.
    Using the Where Not statement worked.
    Where Not (External_Status_CD = 'M' and EXT_STAT_RESN_CD = 52 ) 
    I’m curious why the first statement didn’t work?
    Can anyone explain why the first query didn't combine the 2 statements but a Where Not did?
    Thank you - Mark
    Another way of looking at it:
    The condition (x AND y) will be TRUE when both x AND y are TRUE.
    If
    sub-condition x is    nvl (Status_CD, 'A') <> 'M'   and
    sub-condition y is  nvl (STATUS_RESN_CD, 0) <> 52
    then any row with status_cd = 'M' fails sub-condition x, therefore the compound condition is FALSE, regardless of status_resn_cd.
    Likewise, and row with status_resn_cd=52 fails sub-condition y, so the compound condition is FALSE regardless of status_cd.
    You used status_cd and status_resn_cd in one example; but
    EXTERNAL_status_cd and EXT_stat_resn_cd in the other.  That's quite confusing.  Also, you'll confuse everyone (including yourself) if status is abbreviated as stat in some places but not in others.  Either way is okay, but be consistent.  The same goes for abbreviating external as ext; pick one or the other, and use the same word in all places.
    Don't forget to check for NULLs.  If  external_status_cd and ext_stat_resn_cd can be NULL, you should say
    Where Not (    NVL (External_Status_CD, 'A') = 'M'
              and  NVL (EXT_STAT_RESN_CD,    0)  = 52
    depending on your requirements.

  • Why am I getting an It works! error message?

    I am trying to logon to a work system and am getting an It works! message after login and nothing more

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • Why won't my movie widget work

    I have a new computer running mac OS 10.7 lion. when I tried o access the movie widget it is black. how can I fix it anfd get it to work?

    What movie widget?
    iMovie?
    Where is it black? In the dock?
    Does it work?

Maybe you are looking for

  • How to compile all forms in a directoy at time?

    Hi friends, thank for your replies for the previous questions. Now How to compile all form modules located in a directory at a time? usually what I know is opening form one by one and compile it. But I want to compile all forms and create executable

  • Import from p2 hd cards to final cut x

    It wont import from my p2 hd cards to my FCX ? any answers?

  • Adobe Shape for Android?

    Are there any plans on the Android version?

  • Getting started with Flash/CF

    Can someone recommend a good on-line tutorial on how to integrate ColdFusion and Flash? Specifically I'm looking to build a flash image gallery that will pull the contents from a db. da

  • Does New BI 7.0 Authorization Concept work on 3.x Queries?

    Hello Experts, I have requirement to restrict the query based on Division. So I have created the Authorization object based on Division from RSECADMIN TRansaction. and then created a Role from PFCG TRansaction. I have have used this Auth. Object from