Results 1 to 11 of 11
  1. #1
    Senior Member Mugiwara's Avatar
    Status
    Mugiwara is offline
    Gender
    Join Date
    Apr 2008
    Location
    Fishman Island
    Posts
    13,485
    Post Thanks / Like
    Retired. RIP
     



    Java Switch sequence help

    I have a long switch sequence with 39 cases. I also have a JMenuItem: "Go Back", which switches me to another JPanel, but once I start the switch sequence, I can no longer use that button. Any idea how I can fix that?


    nvm, i'm an idiot. Should just have put "else{}" around the switch.
     
         
    Last edited by Mugiwara; 04-30-2012 at 10:26 AM.

  2. #2
    So um how u do ? Zawar's Avatar
    Status
    Zawar is offline
    Gender
    Join Date
    Apr 2011
    Location
    Somwhere >.>
    Posts
    30,381
    Post Thanks / Like
    NOoooooo!!!!!! T_T
     

    Re: Java Switch sequence help

    i had this prob then i wrote the button code in both switch cases xD
    it worked but code expanded
     
         

  3. #3
    Uber cool Hokage SenjuTobirama's Avatar
    Status
    SenjuTobirama is offline
    Gender
    Join Date
    Apr 2010
    Posts
    29
    Post Thanks / Like
    This user has no status.
     

    Re: Java Switch sequence help

    from what i can see is the "go back" is only created in that first instance and if it is true in that instance it just continues, it looks like you need something to keep creating that button, have you tried a while loop?
     
         

  4. #4
    Senior Member Mugiwara's Avatar
    Status
    Mugiwara is offline
    Gender
    Join Date
    Apr 2008
    Location
    Fishman Island
    Posts
    13,485
    Post Thanks / Like
    Retired. RIP
     



    Re: Java Switch sequence help

    Quote Originally Posted by SenjuTobirama View Post
    from what i can see is the "go back" is only created in that first instance and if it is true in that instance it just continues, it looks like you need something to keep creating that button, have you tried a while loop?
    The Go Back button works before I start the sequence. As I've said, I have 39 cases. I need a way to stop the sequence from outside the switch loop. I need to give the user the ability to back from the program whenever the user wishes too, not only before he starts the sequence and after the sequence is finished.

    I need that button to override whatever command the switch loop gives.
     
         
    Last edited by Mugiwara; 04-30-2012 at 07:35 AM.

  5. #5
    Uber cool Hokage SenjuTobirama's Avatar
    Status
    SenjuTobirama is offline
    Gender
    Join Date
    Apr 2010
    Posts
    29
    Post Thanks / Like
    This user has no status.
     

    Re: Java Switch sequence help

    then you need to create the button inside the switch, or use exception handling
     
         

  6. #6
    Senior Member Mugiwara's Avatar
    Status
    Mugiwara is offline
    Gender
    Join Date
    Apr 2008
    Location
    Fishman Island
    Posts
    13,485
    Post Thanks / Like
    Retired. RIP
     



    Re: Java Switch sequence help

    Quote Originally Posted by SenjuTobirama View Post
    then you need to create the button inside the switch, or use exception handling
    do you got msn ? Got to finish this project today. Just some last bug fixes and such. That button seems to be the only thing I have problem with fixing.
     
         

  7. #7
    Uber cool Hokage SenjuTobirama's Avatar
    Status
    SenjuTobirama is offline
    Gender
    Join Date
    Apr 2010
    Posts
    29
    Post Thanks / Like
    This user has no status.
     

    Re: Java Switch sequence help

    no i dont have msn, but if you create the button inside the switch it should work, just once you hit the default case im not sure what happens
     
         

  8. #8
    Senior Member Mugiwara's Avatar
    Status
    Mugiwara is offline
    Gender
    Join Date
    Apr 2008
    Location
    Fishman Island
    Posts
    13,485
    Post Thanks / Like
    Retired. RIP
     



    Re: Java Switch sequence help

    Quote Originally Posted by SenjuTobirama View Post
    no i dont have msn, but if you create the button inside the switch it should work, just once you hit the default case im not sure what happens
    You mean to create the buttons in the switch, or just the actionperformed part of the buttons?
     
         

  9. #9
    Senior Member Kagutsuchi's Avatar
    Status
    Kagutsuchi is offline
    Gender
    Join Date
    Sep 2008
    Location
    Why Do You ask, Stalker ?
    Posts
    17,462
    Post Thanks / Like
    Hiding in shadows.
     



    Re: Java Switch sequence help

    @$$Hole got his code Working
    Thank you All for your Help

    ~Thread Closed.
     
         
    Last edited by Kagutsuchi; 04-30-2012 at 10:28 AM. Reason: Un-censored @$$hole.

  10. #10
    Uber cool Hokage SenjuTobirama's Avatar
    Status
    SenjuTobirama is offline
    Gender
    Join Date
    Apr 2010
    Posts
    29
    Post Thanks / Like
    This user has no status.
     

    Re: Java Switch sequence help

    Im glad you got the code to work i hate when im programming and there is just one little thing that isnt working right.
     
         

  11. #11
    Senior Member Mugiwara's Avatar
    Status
    Mugiwara is offline
    Gender
    Join Date
    Apr 2008
    Location
    Fishman Island
    Posts
    13,485
    Post Thanks / Like
    Retired. RIP
     



    Re: Java Switch sequence help

    Quote Originally Posted by SenjuTobirama View Post
    Im glad you got the code to work i hate when im programming and there is just one little thing that isnt working right.
    Especially when the answer to fixing that problem is the simplest in the world.

    Removed the code so that I wouldn't have to answer for plagiarism and shit on the project. (Even though its only 20 lines out of 1000 in that program I link, still ) Just delivered in the project. 5 "games", 4 menus(1 main menu, leading into 3 subjects(math, geography, english, each of the subject had 1-2 programs/games each)), 1 main method. In total 10 Java files. Over 6000 lines of code Hoping for a good grade
     
         

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •