-
Senior Member
|
|
|
 |
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.
-
So um how u do ?
|
|
|
 |
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
|
|
| |
|
|
-
Uber cool Hokage
|
|
|
 |
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?
|
|
| |
|
|
-
Senior Member
|
|
|
 |
Re: Java Switch sequence help
 Originally Posted by SenjuTobirama
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.
-
Uber cool Hokage
|
|
|
 |
Re: Java Switch sequence help
then you need to create the button inside the switch, or use exception handling
|
|
| |
|
|
-
Senior Member
|
|
|
 |
Re: Java Switch sequence help
 Originally Posted by SenjuTobirama
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.
|
|
| |
|
|
-
Uber cool Hokage
|
|
|
 |
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
|
|
| |
|
|
-
Senior Member
|
|
|
 |
Re: Java Switch sequence help
 Originally Posted by SenjuTobirama
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?
|
|
| |
|
|
-
Senior Member
-
Uber cool Hokage
|
|
|
 |
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.
|
|
| |
|
|
-
Senior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|