// Fig. 3.14: ContinueLabelTest.java
// Using the continue statement with a label
import java.awt.Graphics;
import java.applet.Applet;

public class ContinueLabelTest extends Applet {
   public void paint( Graphics g )
   {
      int xPos, yPos = 0;

      nextRow:   // target label of continue statement
         // Up to 5 rows
         for ( int row = 1; row <= 5; row++ ) {
            //xPos = 25;
            xPos = 18;   // set to 7 pixels less to increment at start of inner loop
            yPos += 15;

            // up to 10 columns
            for ( int column = 1; column <= 10; column++ ) {

               xPos += 7;  // forces a blank from continue

               //if ( column > row )
               if ( column == row+1 )
               {
                  continue nextRow; // next iteration of
                                      // labeled loop
                  //continue;       // inner for
                  //break;          // inner for; same effect as continue nextRow
                  //break nextRow;
               }

               g.drawString( "#", xPos, yPos );
               //xPos += 7;  // replaced with line 21 - position before # gets output
            } // End of inner for
         }  // End of nextRow and outer for
   }
}


