Hi David,

I am not sure about the usage of this in the example you are asking
about.  I think that this is overused in the example and may not be
necessary inside the paintComponent method (somebody please correct me
if I am wrong).  I am also unsure about other times it may be useful.
Any light that others can shed on the subject would be helpful.

As for the different for loop:

for ( String line : this.lines )
     paintString( g, line, height += step );

This means -  for each String line in this.lines

It is a for each loop and is equivalent to using:

for (int i = 0; i < this.lines.length; i++){
    String line = this.lines[i];
    paintString( g, line, height += step );
}

I found this page that explains more:

http://www.leepoint.net/notes-java/flow/loops/foreach.html

Jeremy


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to