title: Modifying some java applet code
body: <p>I have the following applet code below and I would like to modify it so that the first and last dot in each row is colored red. I'm really having trouble getting started with this.</p>
  
  <pre><code>import java.applet.*;
  import java.awt.*;
  import java.awt.event.*;
  
  public class ChineseCheckerboardApplet extends Applet {
      public void init() {
          add(new ChineseCheckerboard(this));
      }
  }
  
  class ChineseCheckerboard extends Canvas {
      public ChineseCheckerboard(Applet parentApplet) {
          setSize(400, 400);
      }
  
  
      public void paint(Graphics g) {
          for (int i = 0; i &lt; holesInRow.length; i++)
              drawRow(g, i);
      }
  
  
      void drawRow(Graphics g, int row) {
      int centerX = getWidth() / 2;           // figure out center of display
      int startY = 0;
      int numHoles = holesInRow[row];
      int rowWidth = numHoles * holeDiam + (numHoles-1) * holeGap;    //row width is        number of holes + appropriate number of spacings
      int startX = centerX - rowWidth / 2;            // Starting horizontal position is centerX less half the row width
      int y = startY + row * (holeDiam + holeGap);    // Vertically position based upon which row you're displaying
      g.setColor(Color.BLACK);
      for (int i = 0; i &lt; numHoles; i++) {            // Draw each hole
          g.fillOval(startX + i * (holeDiam + holeGap), y, holeDiam, holeDiam);
          g.drawOval(startX + i * (holeDiam + holeGap), y, holeDiam, holeDiam);
      }
  }
  
  final int holeDiam = 15;
  final int holeGap = (int)(holeDiam * 0.25);
  
  // Here's the array containing the number of holes per row
  
  int [] holesInRow = {1, 2, 3, 4, 13, 12, 11, 10, 9, 10, 11, 12, 13, 4, 3, 2, 1};
  </code></pre>
  
  <p>}</p>