First of all, as they have all said previously, please, Dlangdaman, read the tutorials. If you did I'm sure all your questions would have been answered already. I do not believe you read/tried the tutorial because most of the topics are explained there.
Do you not understand that you're honestly wasting more time this way? Just do the tutorial, I did that tutorial as well way back when, I know it's not as big a deal as you're making it out to be...
Now, perhaps this is just something you're not understanding about all things in programming: different topics are ... different. Though that was a snide remark I'm just trying to get my point across.
You asked how to bring up a gui-like question dialog box asking about whether to continue if bla bla. These are all separate topics, figure out first how to throw an exception, then move onto these issues, one step at a time man.
Listen, throwing an exception does just that, throws an exception. It's like putting up a warning sign on the road whenever there's construction. Except java works so that when it sees a warning sign (exception) it has to respond (people sometimes ignore warning signs and that's why we have accidents... among other reasons).
The response is what you want to be done when the exception occurs. See what Jos wrote in the above post? If you tried the exception tutorial and did some proper research you would understand what the try and catch wrappers do, but I'll basically explain it to you:
Everything wrapped inside try is basically waiting to catch an exception and everything inside catch is what you do when you catch that exception.
So referring again to what jos wrote above, you would somewhere, maybe your main write
[code=java]
try {
// your code here that can throw exception X
}
catch(X x) {
// your code did throw exception X; handle it here
}
[/code]
Where you "handle" it you would do what you want, like popping up a menu and asking the user if they want to stop or continue?
Again, just as jos said, please understand, we want you to understand *how* this works, not just *make* it work.
Good luck,
-blazed
Do you not understand that you're honestly wasting more time this way? Just do the tutorial, I did that tutorial as well way back when, I know it's not as big a deal as you're making it out to be...
Now, perhaps this is just something you're not understanding about all things in programming: different topics are ... different. Though that was a snide remark I'm just trying to get my point across.
You asked how to bring up a gui-like question dialog box asking about whether to continue if bla bla. These are all separate topics, figure out first how to throw an exception, then move onto these issues, one step at a time man.
Listen, throwing an exception does just that, throws an exception. It's like putting up a warning sign on the road whenever there's construction. Except java works so that when it sees a warning sign (exception) it has to respond (people sometimes ignore warning signs and that's why we have accidents... among other reasons).
The response is what you want to be done when the exception occurs. See what Jos wrote in the above post? If you tried the exception tutorial and did some proper research you would understand what the try and catch wrappers do, but I'll basically explain it to you:
Everything wrapped inside try is basically waiting to catch an exception and everything inside catch is what you do when you catch that exception.
So referring again to what jos wrote above, you would somewhere, maybe your main write
[code=java]
try {
// your code here that can throw exception X
}
catch(X x) {
// your code did throw exception X; handle it here
}
[/code]
Where you "handle" it you would do what you want, like popping up a menu and asking the user if they want to stop or continue?
Again, just as jos said, please understand, we want you to understand *how* this works, not just *make* it work.
Good luck,
-blazed
Comment