Exemplo n.º 1
0
  // -----------draws names on screen-----------
  private void displayNames(Graphics g) {

    // draw players names
    drawText(g, "Player 1", TEXT_P1_INITIAL_X, TEXT_P1_INITIAL_Y + 4, Color.green, 22);
    drawText(g, board.player1(), TEXT_P1_INITIAL_X, TEXT_P1_INITIAL_Y, Color.blue, 22);
    drawText(g, "Player 2", TEXT_P2_INITIAL_X, TEXT_P2_INITIAL_Y + 4, Color.green, 22);
    drawText(g, board.player2(), TEXT_P2_INITIAL_X, TEXT_P2_INITIAL_Y, Color.blue, 22);
    drawText(g, "___________", BEAD_TEXT_INITIAL_X, BEAD_TEXT_INITIAL_Y - 4, Color.BLACK, 17);
    drawText(g, " Free Bead", BEAD_TEXT_INITIAL_X, BEAD_TEXT_INITIAL_Y, Color.BLACK, 17);
  }
Exemplo n.º 2
0
 // ---------draws winner on screen--------------
 private void displayWinner(Graphics g) {
   if (winner == 1) {
     // System.out.println( "Printing winner "  + 1 );
     drawText(
         g, board.player1() + " wins!", LOSE_WIN_TIE_TEXT_X, LOSE_WIN_TIE_TEXT_Y, Color.red, 38);
   } else if (winner == 2) {
     // System.out.println( "Printing winner "  + 2 );
     drawText(
         g, board.player2() + " wins!", LOSE_WIN_TIE_TEXT_X, LOSE_WIN_TIE_TEXT_Y, Color.red, 38);
   } else if (winner == 0) {
     // System.out.println( "Printing tie" );
     drawText(g, "DRAW", LOSE_WIN_TIE_TEXT_X, LOSE_WIN_TIE_TEXT_Y, Color.red, 38);
   }
 }