I am having problems reading from a JList, my application consists in adding text line by line from a text file to a JList, ..and the problem that i am facing is...how can i read elements from Jlist, character by character .... help please....
I have to say it is a bit difficult to follow your code as it doesn't seem to be complete (for instance where do the for loops for k and j finish?).
But looking at the code as it stands and at the error message it is basically saying that you are trying to reference a part of the string ('s1') that does not exist. You should be able to see this if you output the length of the string 's1' and the value of k where it fails (you'll probably find that k >= s1.length()).
<hint>Remember that String.charAt(int) references the string as it would a list so characters are retreived from position 0 rather than 1.</hint>
Also not sure if you have been asked to use for loops for your project but if not you may want to have a look in using StringTokenizer, this should take a lot of the pain out of what you are trying to do.
Have fun...
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?