is it possible to use == here?
My code is compiling and the window is being created, the index is filled...but im not getting the output.
I am basically trying to "do until"
but java doesn't have that
I was trying to use a while loop...but I cant think of how that would work?
I need the loop to loop exactly "Index" amount of times.
If you are getting an exception, you have no way of knowing. If you're not sure how to handle it yet, or you can't be bothered doing anything complicated, at least print the stack trace.
Secondly, that's not an SSCCE - it's not something we can pick up and run. And so you need to tell us what the output is, and what you were expecting. "not getting the desired result" leaves us guessing.
Beyond that, without trying to unpick everything at the same time - do you really mean to have two loops? It seems as if you check that the scanner has more content...but then you read several lines in sequence that might not be there.
The other thing you want to check is that useableIndex is what you think it is - print out the value (or step through it with a debugger) to check.
oops I don't know how to handle the exception yet.
(but if I am reading from a file, and the information is being read in...I can assume its working?)
(for testing purposes of course...not quite sure what a stack trace is?)
as far as SSCCE, even if I posted all of my code...some stuff is being taken from servers etc.
couldnt be run from your machine unless you some how infiltrated...
yes I mean to have two loops.
the permissions are listed in the same order in the file as the users list in the combo box.
so I am trying to use the selected index to control the amount of times the loop loops...
so the permission corresponding to the index will be isolated.
I tested the indexes.
they are being received correctly.
but for some reason (maybe its the two loops conflicting?)
its not looping index amount of times.
and I was trying to figure out how I could make this work in a do loop...but I am still stumped there?
hope this makes more sense this time.
(or makes it more confusing)
if the first item in the combo box is selected the selected index is 1
and so on
(right now there are 5 in the box)
if I print them out to the text field
but when im using the selected index as the loop determinant;
Jonathan Caldwell wrote:I don't know how to handle the exception yet.
You don't have to know how to handle it, but you need to know if one is happening. That's why you (at minimum) print the stack trace - so you know you need to do something. THEN you can figure out what that would be.
Jonathan Caldwell wrote:(but if I am reading from a file, and the information is being read in...I can assume its working?)
nope. Not if you are swallowing the exceptions
Jonathan Caldwell wrote:not quite sure what a stack trace is?
it's basically a dump of all the method calls currently on the stack. More generally, it will show you where "something went horribly wrong", and let you start to figure out how to resolve it.
Jonathan Caldwell wrote:as far as SSCCE, even if I posted all of my code...some stuff is being taken from servers etc.
You clearly don't understand what a SSCCE is then, if you think this is what we want.
Jonathan Caldwell wrote:its not looping index amount of times.
how many times is it looping? is index changing? How do you know?
I stand by the fact that System.out.printnln() is your best friend. Put it all through your code. Put it in before you enter your loop, and make sure Index is what you think it should be. Put it as the first statement in the loop, and print Index and i. put it at the end of your loop, and print them again.
I feel like a goofball.
sorry Matthew Brown you were right. I didnt need both loops.
its working now.
now I have
and so on.
I was making it more complicated than I need to
I need to look into SSCCE I think when I was reading (quickly) I skipped over the self contained part
I will also look into stack trace.
I am new to java and new to programming in general. im not sure if I am doing things the right way... not sure if process or results are more important?