954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem with for loop

This is the error message i get when i try and use the foor loop,

cannot find symbol - variable split result

for(int i=0;i<=216;i=i+3){
      MyPanel.txtbyellowentry.setText(splitresult[i+2]) ;
        MyPanel.txtbgreenentry.setText(splitresult[i+2]) ;


What i am doing is, in my other class(matchlist) i am using a stringbuilder to send a group of matches to a text area (in the mypanel class where my foorlopp is located), then, in the same class i am using the splitreult method with the ("\ \ s") which looks for the blank spaces and breaks the one string in to an array of many. The idea is then by using the

MyPanel.txtbgreenentry.setText(splitresult[0]);
        MyPanel.txtbyellowentry.setText(splitresult[2]);


i set the first two names to apprpriate text boxes. My problem arises hwoever when i try to increment the names on the push of a button so the two orignal names are replaced by another, i realise its because they are in different classes, whats the easiest way to solve this?

im sorry if this is vague, i tried to explain the best i can, if anyone wants to help and needs more information please say and ill provide it

rickilambert
Newbie Poster
12 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

well, the error is clear.
There's no array called "splitresult" so you can't access it.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

yeh i no this, i just dont no how to fix it, is there anychane you could point me to a resource online so i can adopt and modify it, or could you give me another example so i can use it for resources, as this is what i am struggling with

rickilambert
Newbie Poster
12 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Your classes should provide methods to access the information that is needed. To call those methods, you need a reference to an instance of that class. I'd recommend reading through some of this material http://www.faqs.org/docs/think_java/TIJ304.htm

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

maybe learn to write correct English and people will be able to help you, kid.
As it is your ramblings are utterly incomprehensible.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You