The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

<Deleted><Deleted>2004-12-15 09:22:56
  Moderated for breaking horizontal scroll (re-post) by Nea 2004-12-15 09:24:13
JAVA help.[by McGowan]

Just a small issue really, barely worth mentioning but again I like things to not crash! I have a simple do loop
do
{
  char choice = Text.readChar("1. Add tenant" + 
                             "\n2. list tenants" + 
                             "\n3. exit");

  switch (choice) 
  {
    case '1':
      {
         System.out.println("1");
      }
      break;
    case '2':
      {
         System.out.println("2");
      }
      break;
    case '3':
      break;
    default:
      {
        Text.showMessage("Invalid choice");
      }
      break;
} while (choice != '3')
System.exit(0);
What that should do is pop up an input box asking for a selection between 1 and 3 if it is none of those then it should loop back and ask for a number again. My problem is, I want it to quit the system if the user clicks cancel.

Any ideas? (if there are syntax errors its because that is a written simplified form of what I have and not copied and pasted)
[ Reply ]
    Thanks Nea by McGowan2004-12-15 09:25:10
    Try/catch statement saved the day. by McGowan2004-12-15 10:06:30
      That is a crude and unusual fix. :-) by shorty822004-12-15 10:08:54
        I dont know if it is myself. by McGowan2004-12-15 10:27:09
          Perhaps by Didactylos2004-12-15 10:46:23
            For some reason by McGowan2004-12-15 10:50:21
              :-D by Didactylos2004-12-15 10:55:58
              :-D by Didactylos2004-12-15 23:40:34
      Why on earth? by Didactylos2004-12-15 10:24:35

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)