title: Java: Chess - Moving a piece
body: <p>I would like to move the piece using my mouse.</p>
  
  <p>For example, say there's a pawn sitting on a square on the chess board.
  If my mouse was to click (press and release) in the square that the pawn is in, it would be selected. Afterwards, I would click (press and release) in an appropriate square. Say, the square in front of it since that is a proper move in Chess. The pawn would move (get erased from the square it was on, then redrawn on the new one) to the final selected square.</p>
  
  <p>Currently, the Pawn is just sitting on a square when execution is finished.
  If it's any help, I am using Ready To Program Java (my teacher told me to) as well as the c console (c = new Console();).</p>
  
  <p>Here is the source code of what I have done so far :)</p>
  
  <pre><code>import hsa.Console;
  import java.awt.*;
  
  public class Chess
  {
      static Console c;
  
      public static void main(String[] args)
      {
          c = new Console(30, 100);    // Rows, Columns (X = 790px &amp;&amp; Y = 600px)   
  
          Board();
          Pawn();
      }
  
      public static void Board()      // Board: 504px x 504px     Square: 63px x 63px
      {
          int Horizontal = 143;   // Board's origin point (X)
          int Vertical = 48;      // Board's origin point (Y)
  
          for (Vertical = 48; Vertical &lt; 552; Vertical+=63)       // Moving onto the next "line"
          {
              for (Horizontal = 143; Horizontal &lt; 647; Horizontal+=63)    // Filling the "line" with squares
              {
                  c.drawRect(Horizontal, Vertical, 63, 63);   // Drawing the Squares
              }
              Horizontal = 143;       // Resetting the "line"
          }
      }
  
      public static void Pawn()       // Image and properties of a PAWN piece
      {
          c.setColor(Color.red);          // How the Pawn looks
          c.drawOval(143, 111, 63, 63);   
      }
  }
  </code></pre>