Delaying execution until a specified time

All,
I am developing a web application using Java servlets (no JSPs). What I have been trying to accomplish is to pass a date in a specified format to a servlet, have the servlet parse the date, and then upon that specified date complete its actions. The passing of the date and parsing works fine, and I can actually get the difference between the specified date and the current date and execute a Thread.currentThread().sleep(difference), but this only seems logical for dateTimes that are fairly close to the current dateTime. This method would obviously not be useful if one wanted to send a date three months from now to this servlet. My question therefore is, Is there a better way to accomplish this?

Thank you so much for your reply, and I am sorry that this reply has taken me so long. I believe that this will work, but it essentially has the same issue of as I am facing in that it would not be very useful in scheduling a task three months from any given date, because internally it uses the Object.wait(long) method for a given Thread. This would mean, if i am thinking correctly, that my servlet would have to be executed in a browser that would need to be open constantly until execution (three months)? If this is not the case, then please correct me. OItherwise, I may have to take this particular functionality out of a servlet and place it in a stand alone app.

Similar Messages

  • Is it possible to delay a download untill a specified time?

    I have very slow and limited bandwidth.  My isp provides free bandwidth from midnight to 6:00AM  Since I am trying to update my iphone software, and it will take 3 hours, I would like to do it overnight.  Is it possible to set it to do it at that time?

    There's no way I can think of besides beginning it, then pausing the download, then coming back right before you go to sleep and resuming it again.  The phone will only need to be connected when you first plug it in to begin the download.

  • How can I disarm the counter in a specified time?

    I am using 6602 counter. I use 2 counters to perform "Buffered Period Measurement ". I use internal time base (20MHz) as the SOURCE, and wire the signal to the Gate. The counters are triggered by a trigger signal.
    Now I just want to stop counting the signal in a specified time after the counters triggered. After that time, even the input signal is still running,the counting must be stopped. How can I implement this purpose? I don't know how to disarm the counter when the counter are still running, and how to exactly determinate the stop time.
    Thanks for any advise. I have attach my present routine here.
    Attachments:
    counters.vi ‏192 KB

    Just to expand a bit on Justin's answer to outline a few particulars.
    You mentioned using 2 counters to capture buffered periods so I'm assuming that you'll enable triggering to guarantee that they both have the same start time. Note that in this scheme, element #0 of your array of buffered periods will represent the time from the Trigger edge until the first Gate edge.
    Since your description made it sound acceptable to ignore pulse periods occurring later than the interval of interest, perhaps you can collect data for a little longer than necessary, then reset the counters and trim off the periods that came in "too late" using 'Array Subset.' A quick-and-dirty way is to loop over each array of periods, performing a cumulative sum until it exceeds the specified data collection time interval. That'll tell you the length of the subset you need to keep.
    The hard part is that after starting the measurement, you'll need to poll task attributes/properties to determine when the trigger has been received. Only after that's been determined would you start keeping track of approximate time in software.
    There are ways to do the timing in hardware if you get more of the 6602's counters involved. Here's one way:
    1. First configure your 2 counters for buffered period measurement. However, instead of using the internal timebase for a Source, use another counter's output as a Source. Under DAQmx, the internal routing details are handled for you; under traditional NI-DAQ, you'll need to make explicit routing via RTSI.
    Note that in this scheme, these 2 counters don't need to be triggered.
    2. Next, generate a finite-duration pulse train at 20 MHz (examples can be readily found under LabVIEW help or this website). This pulse train should last for your data collection time interval, and will act as the Source signal for your period measurements. It is important that the period-measuring counters are started before the finite pulse train.
    The finite pulse train uses 2 counters -- one to generate the output pulse train at 20 MHz and a "helper" that produces a single pulse whose duration equals your data collection interval time.
    If you need to synchronize to some external trigger signal, you can set the "helper" counter to be triggered, but there'll be one subtle catch. The first period measurement in your buffers will not include the time from the external trigger signal until the beginning of the single "helper" pulse, i.e., the "delay" time spec for the pulse. You can either make this very very short and ignore it, or make it any convenient duration and then add it to the first period measurements. Be careful though: the timebase for this "delay" time isn't necessarily the same as the timebase used to measure periods.
    There's quite a bit of complication there, so let me suggest an easier way that assumes no need to synchronize to an external trigger. (I'll use DAQmx terminology, since the traditional NI-DAQ would get complicated again with explicit RTSI signal routing.)
    A. As describe in #1 above, configure your period-measuring counters to use a 3rd counter's output as the timing source terminal.
    B. After starting your 2 period-measuring counters, start up the 3rd counter to generate a continuous 20 MHz pulse train.
    C. After the 3rd counter starts, call the 'Wait (ms)' function from the Time & Dialog palette. Wait for slightly longer than your desired collection time.
    D. Read all buffered periods from the counters. You may need to first query each to find out how many are waiting to be read.
    E. Reset all 3 counters.
    F. Do the cumulative sum work on the two buffered period arrays to determine where each should be truncated.
    Note that step "C" above will leave you stuck while data is being collected. A small variation would be to read a reference time ("Tick Count (ms)") right after starting your 20 MHz counter, then set up a loop that allows you to terminate early (logical OR of, say, "abort" button, data acq error cluster error, and time comparison). In that loop, you put a delay of maybe 50-200 msec using "Wait (ms)."
    "Wait (ms)" will output a tick count from which you subtract the reference time. When the difference exceeds your data collection time, you can exit the loop and continue with step D above.
    -Kevin P.

  • How to delay execution?

    I have several loops. I need to delay each round of execution in those loops by a specified time interval. This is quite easy in C,C++ where we just use delay() function as one statement inside the loop. Is there any equivalence in Java?
    The solution of using Timer is not acceptable, as it makes the things too complicated compared to just using one function.
    I'd appreciate for the better solution.
    Thank you.

    Hi Raju,
    Are you familiar with the "sleep()" method in class "java.lang.Thread"?
    Here is a link to the javadoc:
    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Thread.html#sleep(long)
    Is this what you were looking for?
    Hope it helps.
    Good Luck,
    Avi.

  • Job not released in the given specified time(Job_close)

    Hi,
    I need to run a program through job.I created a job using JOB_OPEN
    And submitted the job name and job count to the required program
    And closed the job using JOB_CLOSE.
    My problem is the job getting scheduled but not released/ processed automatically by the specified time I need to release it manually through SM37.
    My code.
    JOB_OPEN
    SUBMIT VIA job_name and job count
    l_time = sy-uzeit + 60.
    CALL FUNCTION 'JOB_CLOSE'
                EXPORTING
                  jobcount             = l_jobcount
                  jobname              = l_jobname
                  SDLSTRTDT            = sy-datum
                  SDLSTRTTM            = l_time
                  STRTIMMED            = 'X'
                IMPORTING
                  job_was_released     = l_released
                EXCEPTIONS
                  cant_start_immediate = 1
                  invalid_startdate    = 2
                  jobname_missing      = 3
                  job_close_failed     = 4
                  job_nosteps          = 5
                  job_notex            = 6
                  lock_failed          = 7
                  OTHERS               = 8.
    After the above code execution SY-SUBRC is ‘8’ and And the L_released is having balnk.If I pass start immediately the the job processed immediately. And the L_released is having ‘X’.
    Please help me….

    If you are trying to set up the job to start at some point in the future - use the SDLSTRTDT and SDLSTRTTM, but do not set the STRTIMMED to 'X'.  You can either schedule it for the future (with the sy-datum and sy-uzeit+60 you desginated) or you can set it to begin immediately.  But I don't believe you can do both.
    In your code example, your are setting both the "start immediately" plus giving it a future date and time.
    Give that a try and see if it helps.
    -Mark

  • Error Message : Object could not be scheduled within the specified time interval

    Post Author: mohamed elkashef
    CA Forum: Publishing
    Dear All when i try to run event for daily reports it sometimes take generation status failed with this error  message : Object could not be scheduled within the specified time interval so  i need to know the reason of failure and how can i fix  this error  thanks a lot 

    Post Author: nvnaresh
    CA Forum: Publishing
    Dear jsanzone,
    I'm facing the same error even when the server time out is more than the query execution time of the report.By server time out I assume connection time out of WebI report server which I have set to 180 min.But the actual query takes maximum of 5 min.
    We are using BO XIR2+SP2.
    I scheduled a webI report to get saved in Excel format to an Unmanaged disk location upon a File Event.
    We have 3 such reports to be scheduled on the same event.
    Expected frequency of File Event getting fired in a day is twice.Scheduling frequency I have set it as every one hour with the file event.
    This usually should work fine.
    But frequently 1 or 2 of the above 3 instances are getting failed with the following error "Object could not be scheduled with in specified time interval " after being in Running state for few hours(8). Amazingly this is not happening every time. May be once or twice in a week.This works fine after I restart the BO services and the same thing repeats after 3 or 4 days.
    Do I need to increase any server parameters?
    Why is this happening randomly?  

  • Weather App that reports to your notification center at a specified time?

    Here's the scenario:
    I work outdoors and live in the Midwest so the weather can and often does vary A LOT from day to day.
    I plug my iPad in for the night and go to sleep.
    When I wake up, I hit the home button to see my notification center. Contained there is the report from this weather app, telling me the basic information immediately: Current temperature, the day's high/low, any preciptiation chance.
    Now here's the added bonus that I really want:
    Everyone knows the temperature changes drastically from night to day, so a temperature reading would need to be taken near to the time that you wake up. What if you could set this app to display the information at a certain time? It's a concept just like an alarm where an action is triggered at a specified time, in this case, weather readings. Say I'm getting up at 6am. I'd set the app to report at 5:55am or something like that.
    OR the much simpler apprach would just be to add a weather widget of some sort to the lock screen. If that's an option, I'd gladly go for that as well.
    So does anything like this exist?
    Thanks to all!
    [EDIT]
    I found the solution to my question. I had a feeling it was something really easy that I was just missing. Thanks! Feel free to delete this thread. I would but I'm not sure how or if I even can.

    You are correct that things would be easier if it was automatic. However, you will generally find that it is a program with a built-in scheduler, such as a backup program or a video recording program, that left some code behind even if the program was trashed or removed from the system.
    As far as the PDP11, I don't think I could afford the electricity to run one even if I had one. The PDP11 is the first computer I was exposed to in medical imaging. I list it because every once in a while it draws out the truth from folks like yourself when they admit to knowing what one is.
    I think the first disk drives that thing used were housed in recycled washing machines using the old motors to drive the spindles.
    -DP

  • Lock Frontpanel when user takes no activity in a specified time

    Hello !
    I have a PanelPC with Touchscreen and want to lock the frontpanel when the user doesn't make an input for a specified time. After this time the frontpanel locks and shows a password input to unlock the frontpanel. How do i detect if the user makes no input ? The VI has to run, because it makes an automatic control/ regulation of a factory. I found an example with a password protection, but i don't know how to detect the user input. Can anyone help me ?

    You can monitor the "mouse events" and also the "keypress events (using the keyboard)" and with this FP can be locked/unlocked based on the time out. 
    Create an event structure so that it will be easy to handle the mouse events. Add another frame of this event structure which can be used for handling the timeout and when ever a event occurs on the FP you can reset it to 0
    Regards
    Guru (CLA)
    Attachments:
    timeout.vi ‏13 KB

  • How to schedule a concurrent request to run at a specified time/day?

    Hi All,
    How to schedule a concurrent request to run at a specified time/day (ex: Sunday 12pm)?
    Thanks,
    Chiru
    Message was edited by:
    Megastar_Chiru

    Is this to run periodically ?
    During the request submission, click schedule, choose the specific days, and click on S = Sunday.
    Change the start date on the date of the sunday you want to run, eg : 15-JUL-07 14:00:00, change the end date as well.

  • Schedule job with JOB_CLOSE until a certain time

    Hello all,
    I'd like to schedule a background job with JOB_CLOSE until a certain time, i.e. first start time at 10 a.m., repitition period 15 min., last start time 1 p.m.
    I tried this using parameter LASTSTRTTM, e.g.:
    i_startdate = sy-datum.
    i_starttime = '100000'.
    i_prdmins = '15'.
    i_laststrtdt = sy-datum.
    i_laststrttm = '130000'.
    CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = l_jobcount
          jobname              = 'MY_JOB'
          sdlstrtdt            = i_startdate
          sdlstrttm            = i_starttime
          laststrtdt           = i_laststrtdt
          laststrttm           = i_laststrttm
          prdmins              = i_prdmins
        EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          OTHERS               = 8.
    but I didn't succeed - the job didn't stop at 1 p.m. Any hints?
    Best regards
    Martin Lehmann

    Hi Martin,
    i_startdate = sy-datum.  " 1st time Job Start Date
    i_starttime = '100000'.
    i_prdmins = '15'.
    i_laststrtdt = sy-datum.  " If Job is not started by this date, then it wont be started once this date is completed
    i_laststrttm = '130000'.
    What it means is, if i want to start a job by 10th Oct.. & expect that it should be started maximum by 20th Oct.. If its 20th Oct & still the job is not started,... then terminate the job & do not start it..
    If the job is already started, then it wont stop.
    Hope its clear.
    Best regards,
    Prashant

  • How to Set Automatic to turn on and off at specified time my TV with STB

    It seems very frustrating talking with Verizon tech support, that's why I turn to you guys to find if anyone knows the answer to my question above.,from my experience calling verizon for my tech support regarding fiosTV and most of my experience from Verizon are either inept and giving the customer the run around by keeping you on hold for the longest and not having the answer after all the time I spend with the tech on the phone or they will tell you that the that there is no such thing; and when you call again when you get another tech on the phone you get completely different answer if not an inept answer. 
    My Specific question is, if  I turned off my STB (top box) and my TV at a particular time; and I like my TV with STB to turn on at a specified time ( example I turned off my STB and TV at 9:00 PM ) and would like my TV with the STB to be turn on like 11:00 PM to turn off at 12:00 midnight by itself, not to record  but just to turn on as reminder and to serve as power saver incase I fall asleep ( this is just example scenario). How would I do that? The manual of either remote control or the STB does not provide that information. My television manual say the TV can but I can not turn it on automatically with the STB connected.
    I called Verizon tech, he first sounded inept and sounded like he just talking from a scripted lines, and would not tell me straight forward that he does not know the answer; I  explained that I switched to Verizon Fios for its claim in high and advance technology as they compare themselves by far higher in technology as compared with Cable or direct TV, and with Cable Vision I was able to used the above automatic turn on and off with the remote; I asked for his supervisor or maybe more expert tech support, He turned over the call to his supervisor, who told me that the STB or the remote Fios TV does not have that level of capability which sounded to me like a joke, he also told me that the STB can not be turn on and off because STB is always set as on; I told him I can see the green light turns on and off on the STB each time I press the ON button on the Verizon Remote; he defended that its always on because the timer is ON, and he told me instead FIOSTV has another feature that although it will not turn the feature on and off automatically, it will serve as reminder, I asked him How to carry out that function, the tech supervisor said  to me to just press the record button on my remote, which I know right away that it will just record, and  I told him that its not what I want to accomplish, this Tech Supervisor insisted that it will not record but will set to notify me, but surely it did record and it just wasted and used my DVR memory capacity the time when he put me on hold for a long period of time, I knew it recorded because the red button on the STB/TVR was on., and it did not notify me in anyway what time the TV and STB will turn on. That was a complete  waste of time, instead of him getting the issue to higher level of their tech support and try to research thru and get back to the client. To me, simple feature as this, is such absurd to claim that fiosTV has more advance features than others, where infact they can not even have their tech support answer such simple question.  
    Any one here has any idea, please help.

    The set top box does not offer any auto on or auto off feature. 
    you can only do that if your TV offers the feature. 
    If neither your TV nor the STB offer that feature (in this case the stb does not offer) then you can go to a radio shack or a similiar store and purchase a AC timer.  they make them and you plug them into your wall, they are very cheap.
    I have had directv and fios and neither of my systems did an automatic on or off. 
    BUT my samsung TV upstairs does have that feature (auto on and off)   and I have not checked my mitsubishi downstairs. 
    so you may want to check your settings on your TV to see if it will do it, like my samsung does. 

  • Running a Java program automatically at a specified time

    How to run a Java appln automatically at a specified time?

    Java Application, or method within a running Java application?
    To run Java you would have to use the OS native tools.
    Windows Scheduled Tasks
    Newbie: Intro to cron.
    To execute a block of code within a running Java VM, you want to look at Timer.

  • Error submitting tasks: Operation could not be completed within the specified time

    I've created a Batch Application and I'm having an issue running a job.  Its suppose to synchronize 2 azure blob containers.
    In my JobSplitter, I compare 2 azure blob containers and find the files in the first container that need to be copied over to the second one.  Just figuring out which files to copy over can take about 5 to 6 minutes the first time this is run depending
    on the number of files that need to get copied over.
    Once we have the files that need to be copied, we group them into sets and create a task for each set.
    The exe that the TaskProcessor runs doesn't do anything just yet. All it does is write the arguments sent to it into a file. Nothing major.
    On the last run, about 900 tasks were created. Four of the tasks completed successfully. I can download the output files for them just fine. The next 4 tasks failed with an error.
    Looking in the JobLogs, I see this:
    The job orchestrator finished
    Failed to process job ac8dd4a3-d882-4ec1-847d-48844fa3e1f4: Error submitting tasks: Operation could not be completed
    within the specified time. RequestId:27eab612-c8ce-4e4b-8dfb-00e7024c71ec Time:2015-01-29T00:37:03.5943898Z
    Has anyone seen this before?
    Thanks,
    matt

    This error is usually a transient error, typically related to an internal storage timeout.  We're working on a fix for it.
    In the meantime, if you go into the Batch Apps portal, select the failed job and click Reprocess in the command bar, Batch Apps should re-run the failed tasks and the not-run tasks.  (Note that the tasks that already succeeded will not be re-run, and
    we will not re-run the job splitter to create new tasks.)
    Please let us know if you continue to see this problem or if reprocessing the job doesn't work for you.

  • Stop execution until GUI is completed

    I wrote a program to monitor a seniority list. If an odd last name, first name, etc is encountered, a gui opens to request the proper form of the name. The problem is that the program keeps running even though the gui has not yet been fililed out. How do I stop execution until the GUI is completed?
    Thanks
    Joe

        public static void readFile2(String lnames   [], String fnames[], String mnames[],
                                     String facs     [], String sdates[], String scores[],
                                     String scrambles[], String filename)
            String tempTitle = "JR";
            System.out.println("Inside ReadFile");
            try
                System.out.println("Inside Try");
                BufferedReader in = new BufferedReader(new FileReader( filename ));
                        //"C:/Documents and Settings/Joe/JavaApplication1/src/test.txt"));
                String tempElement  = "";
                //String tempElements[15];
                String tempElement1 = "";
                String tempElement2 = "";
                String tempElement3 = "";
                String tempElement4 = "";
                String tempElement5 = "";
                String tempElement6 = "";
                String tempElement7 = "";
                String tempElement8 = "";
                String tempElement9 = "";
                String tempElement10 = "";
                String tempElement11 = "";
                String tempElement12 = "";
                StringTokenizer data;
                String S;
                int numberOfTokens = 0;
                int numberOfWords  = 0;
                int numberOfLines  = 0;
                S = in.readLine();
                data = new StringTokenizer(S);
                numberOfTokens = data.countTokens();
                //System.out.println("Next Token " + data.nextToken());
                //System.out.println(data);
                //array[row][col]
                System.out.println("Ready to Tokenize");
                int i = 0;
                int q = 0;
                int lineCount = 0;
                while( ( ! S.equals("") ) && (data.hasMoreTokens() )
                                          && (S.trim().length() != 0))//in.readLine()
                    int col = 0;
                    int j = 0;
                    //while( i < SenListHelpers.getArrayLength(tempElements2) )
                        while( data.hasMoreTokens() )
                            tempElements1[i][j] = data.nextToken();    //get LName
                            System.out.println(" Getting tempElements1[ " + i + " ]" + "[ " + j + " ]" + tempElements1[i][j]);
                            //System.out.println("tempElements [" +  i  +  "] "    + tempElements1[i][j]);
                            j ++;
                        i ++;
                        System.out.println(" i = " + i );
                        int p = 0;
                        System.out.println("tempElements [" +  q  +  "] "    + tempElements1[q][p]
                                                                       + " " + tempElements1[q][p+1]
                                                                       + " " + tempElements1[q][p+2]
                                                                       + " " + tempElements1[q][p+3]
                                                                       + " " + tempElements1[q][p+4]
                                                                       + " " + tempElements1[q][p+5]
                                                                       + " " + tempElements1[q][p+6]);
                        q ++;    
                        //#2
                            ( compareStringByCase(tempElements1[lineCount][0], "DE"    ) ) ||
                            ( compareStringByCase(tempElements1[lineCount][0], "LE"    ) ) ||   
                            ( compareStringByCase(tempElements1[lineCount][0], "LA"    ) ) ||
                            ( compareStringByCase(tempElements1[lineCount][0], "MC"    ) ) ||  
                            ( compareStringByCase(tempElements1[lineCount][0], "ST"    ) ) ||
                            ( compareStringByCase(tempElements1[lineCount][0], "ST."   ) ) ||   
                            ( compareStringByCase(tempElements1[lineCount][0], "VAN"   ) ) ||    
                            ( compareStringByCase(tempElements1[lineCount][0], "EL"    ) )
                        if( ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "DE"    ) ) ||
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "LE"    ) ) ||   
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "LA"    ) ) ||
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "MC"    ) ) ||  
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "ST"    ) ) ||
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "ST."   ) ) ||   
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "VAN"   ) ) ||    
                            ( SenListHelpers.compareStringByCase(tempElements1[lineCount][0], "EL"    ) ) )
                            System.out.println("");
                            correctOfficerGUI test = new correctOfficerGUI(tempElements1, lineCount);
                            test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                            return;// from this method;
    //Here is the GUI class
    public class correctOfficerGUI extends JFrame
            private final JTextField nameInfo, lname, fname, mname, sdate, score, scramble;
            private JPanel form;
            private final JFrame f;
            //EASTERN NY
            public static String nameInfoString   = new String();
            String facilities[] = {     
            "ADIRONDACK",     "ALBION",    "ALTONA", "ARTHUR KILL", "ATTICA",                         
         "AUBURN CORR",  "BARE HILL", "BAYVIEW",     "BEACON", "BEDFRD HILL",                    
            "BUFFALO",      "BUTLER",    "BUTLER ASAT", "GABRIELS",     "GEORGETOWN",                    
         "PHARSALIA",     "CAPE VINCEN", "CAYUGA", "CHATEAUGAY", "CLINTON COR",     
         "COLLINS",     "COXSACKIE", "DOWNSTATE", "EASTERN NY", "EDGECOMBE",                    
         "ELMIRA CNTR",  "FISHKILL",  "FIVE POINTS", "FRANKLIN", "FULTON FAC",                    
         "GOUVERNEUR",     "GOWANDA", "GREAT MEADW", "GREEN HAVEN", "GREENE",                         
         "GROVELAND",     "HALE CREEK", "HUDSON", "LAKEVIEW", "LAKEVIEW ASA",
         "LINCOLN FAC",     "LIVINGSTON", "LYON MTN", "MARCY", "MID-ORANGE",                    
         "MID STATE",     "MOHAWK",     "MONTEREY", "MORIAH SICF", "MT MCGREGOR",     
            "NYC CTL ADM",  "OGDENSBURG", "ONEIDA",  "ORLEANS", "OTISVILLE",                    
         "QUEENSBORO",     "RIVERVIEW",  "ROCHESTER", "SHAWANGUNK", "SING SING",                    
         "SOUTHPORT",     "SULLIVAN",   "SUMMIT",     "TACONIC C F", "ULSTER",                         
         "UPSTATE",     "WALLKILL",  "WASHINGTON", "WATERTOWN", "WENDE",                         
         "WILLARD",     "WOODBOURNE", "WYOMING"};
        public correctOfficerGUI(String[][] array, int lineCount)
            //JFrame
            f = new JFrame("Add Officer");
            // Make a panel to hold the demo �form", then
            // add it to the top of the frame�s content pane
            //JPanel
            form = new JPanel();
            f.getContentPane().setLayout(new BorderLayout());
            f.getContentPane().add(form, BorderLayout.NORTH);
            // Set the form panel�s layout to GridBagLayout
            // and create a FormUtility to add things to it.
            form.setLayout(new GridBagLayout());
            FormUtility formUtility = new FormUtility();
            // Add some sample fields
            System.out.println(array[lineCount][0] + " " + array[lineCount][1] + " " +
                               array[lineCount][2] + " " + array[lineCount][3] + " " +
                               array[lineCount][4] + " " + array[lineCount][5] + " " +
                               array[lineCount][6] + " " + array[lineCount][7] );
            formUtility.addLabel("Name Info: ", form);
            //JTextField
            nameInfo = new JTextField();
            Dimension nameInfoSize = nameInfo.getPreferredSize();
            nameInfoSize.width = 180;
            nameInfo.setPreferredSize(nameInfoSize);
            JPanel nameInfoPanel = new JPanel();
            nameInfoPanel.setLayout(new BorderLayout());
            nameInfoPanel.add(nameInfo, BorderLayout.WEST);
            formUtility.addLastField(nameInfoPanel, form);
            nameInfo.setText(getNameInfo(array, lineCount));
            formUtility.addLabel("Last Name: ", form);
            //JTextField
            lname = new JTextField();
            Dimension lnameSize = lname.getPreferredSize();
            lnameSize.width = 150;
            lname.setPreferredSize(lnameSize);
            JPanel lnamePanel = new JPanel();
            lnamePanel.setLayout(new BorderLayout());
            lnamePanel.add(lname, BorderLayout.WEST);
            formUtility.addLastField(lnamePanel, form);
            //lname.setText("xxx");
            formUtility.addLabel("First Name: ", form);
            //JTextField
            fname = new JTextField();
            Dimension fnameSize = lname.getPreferredSize();
            fnameSize.width = 150;
            fname.setPreferredSize(fnameSize);
            JPanel fnamePanel = new JPanel();
            fnamePanel.setLayout(new BorderLayout());
            fnamePanel.add(fname, BorderLayout.WEST);
            formUtility.addLastField(fnamePanel, form);       
            formUtility.addLabel("Middle Initial: ", form);
            //JTextField
            mname = new JTextField();
            Dimension mnameSize = mname.getPreferredSize();
            mnameSize.width = 20;
            mname.setPreferredSize(mnameSize);
            JPanel mnamePanel = new JPanel();
            mnamePanel.setLayout(new BorderLayout());
            mnamePanel.add(mname, BorderLayout.WEST);
            formUtility.addLastField(mnamePanel, form);   
            formUtility.addLabel("Facility: ", form);
            //JTextField spacer = new JTextField();
            //Dimension spacerSize = spacer.getPreferredSize();
            //spacerSize.width = 20;
            //spacer.setPreferredSize(spacerSize);
            JPanel spacerPanel = new JPanel();
            spacerPanel.setLayout(new BorderLayout());
            //spacerPanel.add(spacer, BorderLayout.WEST);
            formUtility.addLastField(spacerPanel, form);   
         //Container contentpane;
            //contentpane = getContentPane();
         //contentpane.setLayout(new FlowLayout());
            final JList list = new JList(SenListArraySetUp.facilities);
            /* getFacilityIndex( SenListHelpers.getFacility(array, lineCount), facilities ) */
            System.out.println("getFacility     " + SenListHelpers.getFacility(array, lineCount) );
            System.out.println("*******");
            //System.out.println("getFacility     " + getFacilityIndex( SenListHelpers.getFacility(array, lineCount), SenListArraySetUp.facilities ) );
            //getFacilityIndex( SenListHelpers.getFacility(array, lineCount), facilities );
            System.out.println(" ");
            int index = getFacilityIndex( SenListHelpers.getFacility(array, lineCount), SenListArraySetUp.facilities );
            System.out.println("Index    " + index);
         list.setSelectedIndex(0);
            list.setVisibleRowCount(1);
         list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
         //contentpane
            spacerPanel.add(new JScrollPane(list));
            formUtility.addLabel("Seniority Date: ", form);
            //JTextField
            sdate = new JTextField();
            Dimension sdateSize = sdate.getPreferredSize();
            sdateSize.width = 70;
            sdate.setPreferredSize(sdateSize);
            JPanel sdatePanel = new JPanel();
            sdatePanel.setLayout(new BorderLayout());
            sdatePanel.add(sdate, BorderLayout.WEST);
            formUtility.addLastField(sdatePanel, form); 
            sdate.setText(array[lineCount][SenListHelpers.getSenDateIndex(array, lineCount)]);
            formUtility.addLabel("Score: ", form);
            JTextField score = new JTextField();
            Dimension scoreSize = score.getPreferredSize();
            scoreSize.width = 20;
            score.setPreferredSize(scoreSize);
            JPanel scorePanel = new JPanel();
            scorePanel.setLayout(new BorderLayout());
            scorePanel.add(score, BorderLayout.WEST);
            formUtility.addLastField(scorePanel, form);       
            formUtility.addLabel("Score: ", form);
            //JTextField
            score = new JTextField();
            Dimension scoreSize = score.getPreferredSize();
            scoreSize.width = 30;
            score.setPreferredSize(scoreSize);
            JPanel scorePanel = new JPanel();
            scorePanel.setLayout(new BorderLayout());
            scorePanel.add(score, BorderLayout.WEST);
            formUtility.addLastField(scorePanel, form); 
            score.setText(array[lineCount][SenListHelpers.getArrayColLength(array, lineCount)]);
            formUtility.addLabel("Scramble: ", form);
            //JTextField
            scramble = new JTextField();
            Dimension scrambleSize = scramble.getPreferredSize();
            scrambleSize.width = 30;
            scramble.setPreferredSize(scrambleSize);
            JPanel scramblePanel = new JPanel();
            scramblePanel.setLayout(new BorderLayout());
            scramblePanel.add(scramble, BorderLayout.WEST);
            formUtility.addLastField(scramblePanel, form);       
            JButton addButton = new JButton("Add");
            form.add(addButton);
            //addButton.add(       
         addButton.addActionListener(
              new ActionListener()
              public void actionPerformed( ActionEvent actionEvent )//valueChanged(ListSelectionEvent e)
                        System.out.println("LName is:    " + lname.getText());
                        System.out.println("FName is:    " + fname.getText());
                        System.out.println("MName is:    " + mname.getText());
                        System.out.println("Facility is: " + SenListArraySetUp.facilities[list.getSelectedIndex()]);
                        System.out.println("SenDate is:  " + sdate.getText());
                        System.out.println("Score is:    " + score.getText(/*SenListHelpers.getArrayColLength(array, lineCount - 1)*/));
                        System.out.println("Scramble is: " + scramble.getText(/*SenListHelpers.getArrayColLength(array, lineCount)*/));
                        nameInfoString = lname.getText()    + " " + fname.getText() + " " + mname.getText() + " " +
                                         SenListArraySetUp.facilities[list.getSelectedIndex()]
                                                            + " " + sdate.getText() + " " + score.getText() + " " +
                                         scramble.getText();
                        //System.out.println("Size is: " + SenListHelpers.getArrayLength(SenListArraySetUp.NYSDOCS_Alpha_List_LastNames));
                        insertMethods.insertIntoNYSDOCSAlphaHelper(
                           lname.getText(), fname.getText(), mname.getText(),     
                          facilities[list.getSelectedIndex()],               
                          sdate.getText(), score.getText(), scramble.getText() );
                        //form.cl
                        f.dispose();
                        JOptionPane.showMessageDialog(null, "The Officer has been Added.");
                        //return;                   
                        //System.exit(0);
                        //System.out.println("Facility is:    " + facilities[list.getSelectedIndex()]);
                        /**/ //System.out.println("Facility is:    " + facilities[list.getSelectedIndex()]);
                  //contentpane.setBackground(listColorValues
                        //[list.getSelectedIndex()]);
            // Add an little padding around the form
            form.setBorder(new EmptyBorder(2, 2, 2, 2));
    //        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//original close operation
            // Note that we don�t use pack() here, since that
            // may shrink the �last" column more than we want.
            f.setSize(300, 300);//230);
            f.setVisible(true);
            //return;
        }

  • I downloaded music to my iphone and when I went to go sync it up to itunes, I lost all of the songs purchased from that time until the previous time I backed it up. How do I recover these purchased songs that have been lost?

    I downloaded music to my iphone and when I went to go sync it up to itunes, I lost all of the songs purchased from that time until the previous time I backed it up. How do I recover these purchased songs that have been lost?

    All of your music should be in itunes on your computer.
    Select it to sync and sync.

Maybe you are looking for

  • Menu not showing up

    http://highviewhills.com/index.html I have a Menu Machine menu that isn't showing up for the client, who is an Windows IE user. It shows up fine in my Mac Safari and Firefox. It's not overlapping the swf animation at all. I've rebuilt and flattened t

  • Integrating Flash Media Server with other formats

    I would like to create a standard screen/player that can play any of the following formats: windows media files, all flash files, quick time files, real player files. So, for example, lets say I want to manipulate the screen to be an exact aspect rat

  • Bring files to new Mac - bad email address?

    Hi folks. I'm hoping someone can help me out here. I just got a new MacBook Pro, which I want to bring the music from my G5 over to. Now that seems to have worked ok, but now some songs require me to sign in, and thats ok, but it's asking for a passw

  • Office Documents prompting for user name and password

    Hi, We are using SharePoint 2010 and office documents are prompting for username and password when opened from SharePoint. we tried automatic logon setting in internet explorer and set the domain in trusted list of sites but nothing solves the proble

  • Can i upgrade my G5 powermac 8.1 from os x 10.4.11 to 10.5?  Is so How?!

    My Brother has bought a 2007  G5 powermac 8.1 with os x 10.4.11 installed.. I've tried to update it to the current software but it keeps saying i first of all need 10.5..  I'm finding mixed answers in the forums about whether this can be done at all.