Exemplo n.º 1
0
 private void LoadComboBoxPieces() {
   cmbWhitePlayer.setModel(
       new DefaultComboBoxModel(this.gameCtrl.getGame().getWhite().getPiecesAviables().toArray()));
   cmbBlackPlayer.setModel(
       new DefaultComboBoxModel(this.gameCtrl.getGame().getBlack().getPiecesAviables().toArray()));
   Piece pieceWhite = (Piece) cmbWhitePlayer.getSelectedItem();
   txtWhiteX.setText(String.valueOf(pieceWhite.getX()));
   txtWhiteY.setText(String.valueOf(pieceWhite.getY()));
   Piece pieceBlack = (Piece) cmbBlackPlayer.getSelectedItem();
   txtBlackX.setText(String.valueOf(pieceBlack.getX()));
   txtBlackY.setText(String.valueOf(pieceBlack.getY()));
   // cmbStoredGames.setModel(new DefaultComboBoxModel(getStoredGames().toArray()));
 }
Exemplo n.º 2
0
  private void ShowPiecesPositions() {
    Object columnNames[] = {"Fichas", "X", "Y"};
    DefaultTableModel whiteModel = new DefaultTableModel(columnNames, 0);
    DefaultTableModel blackModel = new DefaultTableModel(columnNames, 0);
    List<Piece> WhitePieces = gameCtrl.getGame().getWhite().getPiecesAviables();
    for (Piece piece : WhitePieces) {
      Object rowData[] = {
        piece.getClass().getName(), String.valueOf(piece.getX()), String.valueOf(piece.getY())
      };
      whiteModel.addRow(rowData);
    }
    tableWhite.setModel(whiteModel);

    List<Piece> BlackPieces = gameCtrl.getGame().getBlack().getPiecesAviables();
    for (Piece piece : BlackPieces) {
      Object rowData[] = {
        piece.getClass().getName(), String.valueOf(piece.getX()), String.valueOf(piece.getY())
      };
      blackModel.addRow(rowData);
    }
    tableBlack.setModel(blackModel);
  }
Exemplo n.º 3
0
 private void cmbBlackPlayerItemStateChanged(
     java.awt.event.ItemEvent evt) { // GEN-FIRST:event_cmbBlackPlayerItemStateChanged
   Piece piece = (Piece) cmbBlackPlayer.getSelectedItem();
   txtBlackX.setText(String.valueOf(piece.getX()));
   txtBlackY.setText(String.valueOf(piece.getY()));
 } // GEN-LAST:event_cmbBlackPlayerItemStateChanged