How do i make an error message come up if i type a letter not a number

Hi i have a problem with a program that when i type a letter where a number should be in JOptionPane the program crashes as it should. I would like it to return an error message i know how to return an error message if an incorrect number is returned if (sTimeHours >24 || eTimeHours > 24)
My question is what do you type in for an incorrect letter.

User entry Is what i think tou mean here is some of the code
while(true){
String one = JOptionPane.showInputDialog(null,"Please enter your start hours and minutes in 24 hr time\n with a - between the hours & minutes" );
     String two = JOptionPane.showInputDialog(null,"Please enter your finnish hours and minutes in 24 hr time\n with a - between the hours & minutes");
String[] startTime = one.split( "-" ), endTime = two.split( "-" );
int sTimeHours = Integer.parseInt( startTime[0] ), sTimeMins = Integer.parseInt( startTime[1] );
int eTimeHours = Integer.parseInt( endTime[0] ), eTimeMins = Integer.parseInt( endTime[1] );
if ( sTimeHours > 24 || eTimeHours > 24 || sTimeMins > 60 || eTimeMins > 60 ) {
if (sTimeHours > 24 || eTimeHours > 24) {
JOptionPane.showMessageDialog(null," HOURS must be less than 24 Hr ", "ERROR!" , JOptionPane.ERROR_MESSAGE);
if (sTimeMins > 60 || eTimeMins > 60) {
JOptionPane.showMessageDialog(null," MINUTES must be less than 60 Sec ", "ERROR!" , JOptionPane.ERROR_MESSAGE);
If some one enters a letter instead of a number how do i give them an error message instead of the program crashing. Also on a further note i have a return to the start statement on this code which works for the minutes but the hours just add up and the program ends any ideas.
Once again if the code dose not present correctly i am sorry i am trying to work out how the code button works

Similar Messages

  • Anyone having issues with importing CR2 files into lightroom 5 as error message comes up saying "Some import operations were not performed". please advise what is a solution please

    Urgent please
    anyone having issues with importing CR2 files into lightroom 5 as error message comes up saying "Some import operations were not performed". please advise what is a solution please

    Sounds like the folder Write permissions issue described here with a solution:
    "Some import operations were not performed" from camera import

  • While accessing my iTunes an error message comes up saying; The requested URL was not found on this server

    While trying to access my library in iTunes, I receive an error message; The requested URL was not found on this server. This only happens with my older songs, but not with the ones I have most recently added? Any thoughts?

    Select the content which is causing a problem and use the 'Report a problem' button in Your Purchase History on your computer.

  • Error message: URL's with the type "file:" are not supported.  I get this pop-up twice each time I enter Safari and Mail.

    Everytime I go into Mail and/or Safari, I receive a pop-up the states "There was a problem connecting to the server.  URL's with the type "File:" are not supported.  The pop-up comes up twice each time and I have to click "ok" to close them.  Only started after install of OS Lion 10.7.  Any one else have this and is there a solution.  It is just plain irrating that is does this each time I check my mail or go on the internet.  Thanks!

    That's interesting. I bet that helps other Safari users! 

  • ITunes 7.1 won't start, invalid Win32 application error message comes up

    I repeatedly tried to download iTunes 7.1 for my new iPod nano on my Windows XP, when the download completes and I try to run the program an error message comes up stating that iTunesupdate.exe is not a valid Win32 application...I have tried erasing iTunes completely then re-downloading it, tried re-intsalling but nothing works. I have been trying to get help for the past month now, no one seems to know anything, this is the last resort please help ASAP.
    Thanx a bunch.

    okay, let's give this document a try:
    iTunes: Windows reports that iTunesSetup.exe is not a "valid Win32 application"

  • How can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,-

    how can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,…"

    It sounds like if you open Preferences in Word there will be a place where you can specify where to store autorecover files. Right now it sounds like it's pointing to somewhere that doesn't exist.

  • I have just switched to samsung and i have removed the sim from the iphone however i am still receiving texts rather 'imessage' on the old iphone. how do i make sure all messages only come to my new phone??

    i have just switched to samsung and i have removed the sim from the iphone however i am still receiving texts rather 'imessage' on the old iphone. how do i make sure all messages only come to my new phone??

    You can turn iMessage off on your iPhone.  That's relatively easy.  Since iMessage is an Apple product/service, I have no idea how a Samsung phone will deal with an incoming one.  For that answer you should probably contact Samsung support.

  • Every Time that I try ot download my songs that I have purchased from Itunes and error message come up, "error 450." Make sure that your network connection is open and try again. What can I do to fix this problem?

    Every time that I try to download my music from I tunes an error message comes up it says, ( err = 450) Make sure that your network connetion is active and try again.  What can I do to fix this problem, I have tried everthing that I-tunes has told me but with no luck. Thanks

    Try disabling your parental controls. Does that help with the 450?
    iTunes: Using Parental Controls

  • When I want to get an app, an error message comes up saying I need 3.0 software update.  How do I get my ipod updated in itunes, when itunes says my ipod is already updated?

    When I want to get an app, an error message comes up saying I need 3.0 software update.  How do I get my ipod updated in itunes, when itunes says my ipod is already updated?
    OR if I cannot update to software 3.0, how can I find apps that will work just for my ipod touch?

    It sounds like you have a 1G iPod Touch, in which case you can only upgrade to iOS version 3.1.  Here is a link to purchase the update.
    http://support.apple.com/kb/HT2052
    B-rock

  • Every time I try to sync my I phone to I tunes an error message comes up saying I do not have enough access to sync. How do I gain the access

    Every time I try to sync my I phone to I tunes an error message comes up saying I do not have enough access to sync. How do I gain the access

    While your iPhone is synching in iTunes, do the following:
    1.  Click on your iPhone's icon on the left.
    2.  Find and click on the "Tones" tab on the upper right of the iTunes display.
    3.  Choose the synch option you would like.

  • Im try to import a large amount of pictures to Iphoto. I have pleant of space on my HD. But half way thru the transfer an error message comes up and says not enough disc space. How can I fix this?

    Im trying to import a large amount of pictures to Iphoto. I have pleanty of space on my HD. But half way thru the transfer an error message comes up and says not enough disc space. How can I fix this?

    I. I want to import 58.64 GB of Photos from an external HD
    2. I have 278.28 GB space left on my HD
    3. The exact error message goes like this......
    Insufficient Disk Space
    iPhoto cannot import your photos because
    there is not enough free space on the
    volume containing your iPhoto library
    I Have researched this and most advice is to empty the iPhoto trash. I have already done this and it did not help.
    Thank you for helping

  • I purchased an album and all of it downloaded except for one song.  after a few auto attempts an error message comes up saying the file is corrupted. how do i get the song i paid for?

    i purchased an album and all of it downloaded except for one song.  after a few auto attempts an error message comes up saying the file is corrupted.  how do i get the song i paid for?
    oh the error msg    error= -100000

    I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not downloading properly. If you can't see "Report a Problem" next to the entry, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.
    (Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.)

  • How do I fix an error message of "failed to open a session on this devices" for my HP photosmart 6510 scanner?

    how do I fix an error message of "failed to open a session on this devices" for my HP photosmart 6510 scanner?

    Hello Kwastfamily,
    It sounds like you are unable to print from your computer to your printer. I would run through the troubleshooting steps in this article:
    Troubleshooting printer issues in OS X
    http://support.apple.com/kb/ts3147
    Make sure that the printer is powered on, has ink / toner, and that there are no alerts on the printer’s control panel. Note: If you cannot clear an alert on the printer's control panel, stop here and check the printer's documentation or contact the manufacturer for support.
    Ensure the printer is properly connected to a USB port on the Mac or AirPort base station / Time Capsule. If the printer is a network-capable printer, make sure that it is properly connected to your home network.
    Use Software Update to find and install the latest available updates. If an update is installed, see if the issue persists.
    Open the Print & Scan pane or Print & Fax (Snow Leopard) pane in System Preferences.
    Delete the affected printer, then add the printer again.
    If the issue persists, try these additional steps:
    Reset the printing system, then add the printer again.
    If the issue still persists, reset the printing system again.  Download and install your printer's drivers. Then, add the printer again.
    Contact the printer vendor or visit their website for further assistance.
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Unable to play some movie from Netflix on my iPad. When I click on a movie an error message comes up which says "cannot play movie. Please try again". Can anyone assist me? I just upgraded to iOS 7.1. Netflix not able to find problem.

    Unable to play some movies from Netflix on my iPad. When I click on a movie an error message comes up "Cannot play movie. Please try again later." I contacted Netflix but have not been able the help so I am wondering if it's my iPad. I didn't have a problem before but I have recently upgraded to iOS 7.1. Also is a certain amount of storage needed to play a movie? About how much is that?

    Hello all,
    I have an iPad 2 16GB with iOS 7.0.3 and Netflix version 5.0.2. I cannot watch netflix on an External LCD monitor that I have through VGA out. I use bluetooth speakers, so the AirPlay is going to that for Audio. Before this update, this combo worked without an issue.
    So as of Friday Nov. 8/2013, I contacted Netflix support, and they said they fixed the problem on their end, and the fix is on the Apple side of things, and to contact Apple support.
    So, I contacted Apple support, and the first person I spoke to said I would have to agree to pay a $35 fee for 30 days of support to this problem since my unit is out of warranty. I said this isn't a hardware issue, it's a software issue, and I'm not willing to pay to fix a problem you created. So I got a Senior Level advisor on the line, and she was helpful, and she's looking into the issue for me and said she'll contact me sometime on Tuesday or Wednesday (Nov. 12 or 13) to let me know of the issue.
    Here's the thing: this is a combination of Netflix and iOS not working correctly with any of the Apple Authorized Dongles. This is truly a code error that some hot shot programmer had major oversight on, and their management didn't catch it either. There was no reason for Netflix to rush to get this Netflix update going until Apple sorted out the bugs in iOS 7.
    Anyway, if I hear anything from Donna (the advisor), I'll post it and let you guys know. In the mean time, good luck!

  • Tried to update itunes but now it wont open,an error message comes up ??

    i have tried to update my itunes but now i am not able to open it and an error message comes up saying "this application has failed to start because MSVCR80.dll was not found . re installing the application may fix the problem" . i dont know how to reinstall it or how to fix it help !??

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99414)

Maybe you are looking for