What would be the code for a previous button?

I am passing Strings from an array to JTextArea. When I hit the "next" button on my jtoolbar, it shows the next string in the array. This is the code I have for the next button:
static final public String NEXT = "next";
String cmd = e.getActionCommand();
String[] arr =
"the strings",
"that i am",
"passing to JTextArea"
if(NEXT.equals(cmd)
showNextValue();
public void showNextValue()
textArea.setText(arr[index]);
index = (index+1)%arr.length;
My question is:
how would I write the code for the method showPreviousValue() without getting an indexoutofbounds exception? It would do the same thing as showNextValue, but show the user the previous string when they hit the previous button.
Thank you!!!

how would I write the code for the method showPreviousValue() without getting an indexoutofbounds exception?I'm guessing that you tried something and got an IndexOutOfBounds exception. You might do better to post what you tried.
Basically you need to figure out why the exception occurs - for instance by printing the value of the expression that you were using as the index value. And then figure out some way of avoiding that problem. (Probably a little bit of arithmetic.)

Similar Messages

  • With SO MUCH photo editing software available, what would be the best for me if I am a digital camera newby? I do not need Photoshop CC! I do not want to spend $700 bucks! My camera is a Nikon D90. Please help.

    With SO MUCH photo editing software available, what would be the best for me if I am a digital camera newby? I do not need Photoshop CC! I do not want to spend $700 bucks! My camera is a Nikon D90. Please help.

    Where did you come up with the $700 figure?
    Photography plan - $9.99/month or $119/year - Creative Cloud Photography plan : Adobe Creative Cloud
    Single App - $19.99/month
    Complete plan - $49.99/month or $599/yr - Creative Cloud free trial & plans : Adobe Creative Cloud
    Ah - If you wish to cancel early yeah $74.99 which would total for the year at $899.88. But that final total would be if you canceled in the 12th month but if you plan on keeping it that long might as well go for the annual contract. Then cancel at the end of the term limit if you need to.
    If you are not sure what to get, Either Elements as was suggested by Peru Bob or the photography plan.

  • What would be the reason for sql server agent [MSSQLSERVER] service terminated unexpectedly?

    What would be the reason for sql server agent [MSSQLSERVER] service terminated unexpectedly?
    only below details found in error log
    07:26:44.170 spid60      
    FILESTREAM: effective level = 3, configured level = 3, file system access share name = 'MSSQLSERVER'.
    07:26:45.720 spid51      
    Configuration option 'Agent XPs' changed from 0 to 1. Run the RECONFIGURE statement to install.
    07:26:45.730 spid51      
    FILESTREAM: effective level = 3, configured level = 3, file system access share name = 'MSSQLSERVER'.
    07:28:57.840 spid64      
    Configuration option 'Agent XPs' changed from 1 to 0. Run the RECONFIGURE statement to install.
    07:28:57.840 spid64      
    FILESTREAM: effective level = 3, configured level = 3, file system access share name = 'MSSQLSERVER'.
    and below error on agent log
    2014-01-01 07:26:28 - ? [131] SQLSERVERAGENT service stopping due to a stop request from a user, process, or the OS...
    2014-01-01 07:26:43 - + [188] Scheduler engine timed out (after 15 seconds) waiting for 1 jobs(s) to stop
    2014-01-01 07:26:44 - + [098] SQLServerAgent terminated (forcefully)
    Rahul

    What would be the reason for sql server agent [MSSQLSERVER] service terminated unexpectedly?
    only below details found in error log
    07:26:44.170 spid60      
    FILESTREAM: effective level = 3, configured level = 3, file system access share name = 'MSSQLSERVER'.
    07:26:45.720 spid51      
    Configuration option 'Agent XPs' changed from 0 to 1. Run the RECONFIGURE statement to install.
    07:26:45.730 spid51      
    FILESTREAM: effective level = 3, configured level = 3, file system access share name = 'MSSQLSERVER'.
    07:28:57.840 spid64      
    Configuration option 'Agent XPs' changed from 1 to 0. Run the RECONFIGURE statement to install.
    07:28:57.840 spid64      
    FILESTREAM: effective level = 3, configured level = 3, file system access share name = 'MSSQLSERVER'.
    and below error on agent log
    2014-01-01 07:26:28 - ? [131] SQLSERVERAGENT service stopping due to a stop request from a user, process, or the OS...
    2014-01-01 07:26:43 - + [188] Scheduler engine timed out (after 15 seconds) waiting for 1 jobs(s) to stop
    2014-01-01 07:26:44 - + [098] SQLServerAgent terminated (forcefully)
    Rahul
    Can you post the output of below query
    select @@version.
    If you are using SQl server express edition ,SQL server agent feature is not available.It seems from errorlog that you can start it but actually you cannot.But first confirm what is version and edition of your SQL server
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • I am passing range table from the method of ODATA Service to FM but In FM range table is becoming initial.What would be the reason for the same?

    I am passing range table from the method of ODATA Service to FM but In FM range table is becoming initial.What would be the reason for the same?

    Vinod, Can you share detail on how are you sending and how are you reading.

  • What would be the impact for disabling admin$, IPC$, Admin Share$

    Can any one update,
    what would be the impact by disabling admin$, IPC$, on Members server.
    we have windows server 2008 r2.
    Only we need to disable memebrs server not on domain controller.
    D.K Konar. NMS

    Hi,
    Disable Administrative Shares permanently disable: IPC$, ADMIN$, C$, D$, E$
    Batch Script Code:
    REG ADD “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters” /f /v AutoShareWks /t REG_DWORD /d 0
    REG ADD “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters” /f /v AutoShareServer /t REG_DWORD /d 0
    REG ADD “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa” /f /v restrictanonymous /t REG_DWORD /d 1@echo.
    net share admin$ /delete
    net share C$ /delete
    net share D$ /delete
    net share E$ /delete
    net stop LanmanServer
    sc config LanmanServer start= disabled
    Auto Share Disable Script Download: http://siberblog.org/wp-content/uploads/2013/10/AutoShareAllDisabled.rar
    Auto Share Enable Script Download: http://siberblog.org/wp-content/uploads/2013/10/AutoShareAllEnabled.rar
    Site Link: http://siberblog.org/index.php/windows-yonetimsel-gizli-paylasimlari-devre-disi-birakma/
    www.siberblog.org

  • How to customize the code for default scroll buttons provided in the table?

    Hi Everyone,
    I want to customize the code for default 'next page' navigation button provided in a table. If this is possible then how it can be done?
    Thanks,
    Swati

    do you mean 'footer' of table, which used to scroll table contents?
    Table footer button is not editable.
    Instead you can try buttons in the table tool bar and can swap elements in the table.And also table footer can be set to showfootoer: false.
    refer thread: [Table Element Swapping|Re: Table with special requirement]
    nikhil

  • Oracle.dataaccess.lite_wce.dll and what would be the dll for berklay and sq

    Hi all,
    With oracle lite and vb.net we are using oracle.dataaccess.lite_wce.dll for data access..
    What is the new dll for the berklay and vb . net for windows mobile 6.x devices.
    What is the new dll for the sqlite and vb. net for windows mobile 6.x devices.
    Please post the url for the downloads of those and the usage of api.
    This will be helpful to others as well.
    Thanks
    Paninie.

    Hi rekounas,
    Thanks for the reply. I downloaded the System.Data.SQLite.dll..site says we need .net compact 3.5 and above for this dll.
    It seems that the application which use oracle.dataaccess.lite_wce.dll has to be changed to suit to
    sqlite..... And im trying to test them.. what is the dll for berklay for the .net? It looks the applications needs lot of changes on this
    and oracle site does not have the requiierd dll in their site like the oracle.dataaccess.lite_wce.dll
    will have to do lot of experiments in doing this...
    Will post the progress once the testing started .. thanks
    paninie

  • What is the code for a reset button that puts the program to start?

    What is the code?
    reset_btn.addEventListener(MouseEvent.CLICK, reset);
    function reset(event:MouseEvent):void
         //Reset all variables and send the playhead to the appropriate frame
    doesn't work!

    Hi,
    I think you are using the pre-defined keyword (RESET), thats why you are facing the problem, try the other word and your problem will be solved, i have tried it in FLASH CS5.
    reset_btn.addEventListener(MouseEvent.CLICK, resetHandler);
    function resetHandler(e:MouseEvent):void
         //Put code reset logic here.
    It will work, as it is properly working.
    VIPUL

  • What would be the reasons for my iMac keyboard to freeze up while online? Several page reloads brings it back but only for one set of typing. If I stop or need to delete it freezes.

    Using Firefox, Safari and Chrome depending on what I am working on or gaming. All recent updates as of 3.19.13
    iMac is fully loaded first quarter 2009 model. I use Office.
    Problem:
    While online typing just stops. This occurs most frequently when I have to change something or delete, it does not matter how many letters or numbers.
    Page reloads sometimes take 2 or 3 times for any effect, then it is only for one straight set of typing. If I have to stop and delete or go back and do something as small as adding a letter it will not type. The is well known muted "dump" sound.
    Is it possible that I was somehow infected with malware? No one else uses the computer and I do not go to any sites I am unfamiliar with or are gambling or ****.
    Help please. I am a writer.

    Take a look at your computer's CPU and RAM usage with Activity Monitor, It some like your system is slowing down not you keyboard.  Take a look at this link, http://support.apple.com/kb/HT1342?viewlocale=en_US&locale=en_US
    Also try to verify/repair your hard drive with disk utility, see this link, http://support.apple.com/kb/HT1782?viewlocale=en_US&locale=en_US

  • I wish to know that I have a crack on the front  camera . What would be the price for replacing the screen, I wish to know that I have a crack on the front  camera . What would be the price for replacing the screen

    What should I do

    Create a backup, then take the iPad to the Apple Store Genius Bar.  You will be offered an Out of Warranty (OOW) replacement at a cost to you.

  • I have an ipod shuffle 1st generation it will work if i connect it to my usb port in car or on computer but i can not get it to work using just headphones what coud be the reason for this

    I have an ipod shuffle 1st generation. it will work ousing usb port in car or on computer but i can not get it to play using headphones. what would be the reason for this.

    Sorry for  the typos, I hope my message still gets across!

  • Does Adobe Reader for iOS have the ability to open inbedded links to additional PDF docs?  If not, then what would be the best way to use these already created PDF's?

    Does Adobe Reader for iOS have the ability to open inbedded links created with Acrobat Standard to additional PDF docs?  If not, then what would be the best way to use these already created PDF's on an I Pad?

    driddy61,
    As of June 2014, none of the Adobe Reader mobile products support the hyperlink action for opening a separate PDF document.
    Adobe Reader for iOS
    Adobe Reader for Android
    Adobe Reader Touch for Windows 8
    In addition, the Reader mobile products do not open multiple windows/documents simultaneously, which would make the navigation between PDF documents nearly impossible. (Once a hyperlink takes you to a different PDF document, you have no way to go back to the original PDF document.)
    The only Adobe Reader product that fulfills your department's requirements is Adobe Reader XI (mostly for Windows/Mac desktop/laptop computers).  Acrobat Pro and Standard are paid products.
    Because you are in search of a less expensive device for your department, you could get a Windows tablet instead of a Windows desktop/laptop computer. Microsoft Surface Pro (that you've mentioned in your previous reply) is just one example.  You can also find other less expensive Windows tablets.
    Tablets
    However, please keep in mind that there are two different types of Windows tablets running two different operating systems.
    (a) A Windows tablet with an Intel-based processor running Windows 8.1 Pro
    Example: Surface Pro 3
    You can install and run traditional desktop apps (e.g. Adobe Reader XI) and new Windows Store apps ("Modern" or "Metro-style" apps).
    (b) A Windows tablet with an ARM-based processor running Windows RT 8.1
    Example: Surface 2
    You can only install and run Windows Store apps (e.g. Adobe Reader Touch) but not traditional desktop apps like Adobe Reader XI.
    In general, type (b) tablets are more affordable than type (a) tablets.  However, if you want to run Adobe Reader XI, you do need to check the technical specification of each tablet and make sure the following conditions are met.
    Processor: Intel
    Operating system:  Windows 8/8.1 or Windows 8/8.1 Pro, not RT
    Hope this helps you choose the right device for your department.  Please let us know if you have any questions about system requirements or supported features in the Adobe Reader products.

  • Had a windows computer with my element 7.  Now just bought a Mac OSX   version 10.9.2 what would be the best photoshop elements for this machine.  I did download elements 12 from Apple store but kept getting incompatible message when trying to open a phot

    I thought elements were simple but maybe it is just me.  Having problems moving photos from iphoto to elements

    Duplicate post; see:
    had a windows computer with my element 7.  Now just bought a Mac OSX   version 10.9.2 what would be the best photoshop elements for this machine.  I did download elements 12 from Apple store but kept getting incompatible message when trying to open a phot

  • I have a 15' Macbook Pro, mid 2010 running Mavericks. I want to upgrade the hardware by increasing the RAM to 8GB and replacing the HD for a SDD one. What would be the best way to install mavericks on the new HD? I have the original OS X CD.

    I have a 15' Macbook Pro, mid 2010 running Mavericks. I want to upgrade the hardware by increasing the RAM to 8GB and replacing the HD for a SDD one. What would be the best way to install mavericks on the new HD? I have the original OS X CD.
    From what I read, I have 2 choices: 1. to install OSX and then upgrade to Mavericks, but I'm not sure if this would be possible (to upgrade directly from OSX to Mavericks); and 2. to use a software called Super Duper.
    I wouldn't like to have to use a third party software to do this, so the question is: is there a better way to install directly the Mavericks not having to use a third party software?

    Install the new drive in the computer.
    Install the old drive in an external USB or Firewire enclosure.
    Boot the computer from the Recovery HD on the external drive.
    Use Disk Utility to partition and format the new internal drive.
    Clone your external drive to the internal drive.
    How to replace or upgrade a drive in a laptop
    Step One: Repair the Hard Drive and Permissions
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Installer menu (Utilities menu for Tiger, Leopard or Snow Leopard.) After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    Step Two: Remove the old drive and install the new drive.  Place the old drive in an external USB enclosure.  You can buy one at OWC who is also a good vendor for drives.
    Step Three: Boot from the Recovery HD on the external drive.  Restart the computer and after the chime press and hold down the OPTION key until the boot manager appears.  Select the icon for the Recovery HD then click on the downward pointing arrow button.
    Step Four: New Hard Drive Preparation
      1. Open Disk Utility from the main menu and click on the Continue button.
      2. After DU loads select your new hard drive (this is the entry with the
          mfgr.'s ID and size) from the left side list. Note the SMART status of
          the drive in DU's status area.  If it does not say "Verified" then the drive
          is failing or has failed and will need replacing.  Otherwise, click on the
          Partition tab in the DU main window.
      3. Under the Volume Scheme heading set the number of partitions from
          the drop down menu to one. Set the format type to Mac OS Extended
          (Journaled.) Click on the Options button, set the partition scheme to
          GUID  then click on the OK button. Click on the Partition button and
          wait until the process has completed.
      4. Select the volume you just created (this is the sub-entry under the
          drive entry) from the left side list. Click on the Erase tab in the DU main
          window.
      5. Set the format type to Mac OS Extended (Journaled.) Click on the
          Options button, check the button for Zero Data and click on OK to
          return to the Erase window.
      6. Click on the Erase button. The format process can take up to several
          hours depending upon the drive size.
    Step Five: Clone the old drive to the new drive
      1. Using Disk Utility still opened.
      2. Select the destination volume from the left side list.
      3. Click on the Restore tab in the DU main window.
      4. Check the box labeled Erase destination.
      5. Select the destination volume from the left side list and drag it to the
          Destination entry field.
      6. Select the source volume from the left side list and drag it to the
          Source entry field.
      7. Double-check you got it right, then click on the Restore button.
    Destination means the new internal drive. Source means the old external drive.
    Step Six: Open the Startup Disk preferences and select the new internal volume.  Click on the Restart button.  You should boot from the new drive.  Eject the external drive and disconnect it from the computer.

  • In BSP-HTMLB what is the code for auto refresh.?

    Hi friends,
    In BSP-HTMLB what is the code for auto refresh.?
    Means i gave the input every 2 minutes once my output should get refresh.
    So what is the code in bsp-htmpb?
    Moosa

    Hi Moosa,
    Many threads on this topic...
    [Auto Refresh - I|Auto refresh]
    [Auto Refresh - II|Auto-Refresh for BSP page]
    [Auto Refresh - III|Page refresh.....]
    Search the forum for more information.
    Regards,
    Anubhav

Maybe you are looking for

  • I am about to throw my Lenovo G550 into moving traffic

    I have seriously at the end of my FREAKING ropes with my Lenovo G550 (2598) laptop.  I swear on my life I am about to go and purchase a new computer and best believe it will NEVER be a lenovo.  I am at the end of my ropes with this piece of crap lapt

  • For loop in whlie loop

    How can I change this programm, that i will always replace the variable C instead of adding it to the value from the last while loop. It is supposed to calculate a new C because the temperature T0 and the pressure P0 are changing. Right now it will a

  • Standard Report Distribution

    Hi Does anyone know if it is possible to create a batch schedule to run a standard report (KSB1), with many Report Variants, each variant being user specific. Once run these individual reports need to distributed to the relevant users in HTML format

  • Passing Streaming Content to a JCA FTP adapter in OSB

    Hi, Is there any way to pass streaming content represented by e.g.<con:binary-content ref="cid:1b6ff6d0:1416f7a74ab:-1d8a" xmlns:con="http://www.bea.com/wli/sb/context"/> to JCA FTP(business service) adapter? My binary content already represents base

  • Grabbled text after OCR

    I'm scanning old law books from a Minolta PS-7000 using IrfanView software, then bringing them up on Adobe Acrobat 8 Standard for PDF files. I then did a text recognition, OCR and some of the pages are OK, but then I come across other pages that have