From 9df5c9ba687fec92d43584af29eefb77fef87b9a Mon Sep 17 00:00:00 2001 From: johnm Date: Sun, 24 May 2020 13:52:48 +0100 Subject: [PATCH] Default unique name for AI. --- .../src/main/java/mage/client/table/NewPlayerPanel.java | 6 ++++++ .../src/main/java/mage/client/table/TablePlayerPanel.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java index 6645b4ab16..c41c5873f7 100644 --- a/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/NewPlayerPanel.java @@ -46,6 +46,12 @@ public class NewPlayerPanel extends javax.swing.JPanel { this.txtPlayerName.setEnabled(false); } + public void setPlayerName(String playerName, boolean editable, boolean enabled) { + this.txtPlayerName.setText(playerName); + this.txtPlayerName.setEditable(editable); + this.txtPlayerName.setEnabled(enabled); + } + protected void playerLoadDeck() { String lastFolder = MageFrame.getPreferences().get("lastDeckFolder", ""); if (!lastFolder.isEmpty()) { diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java index ae68ccddd6..a736c414ff 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java @@ -126,7 +126,9 @@ public class TablePlayerPanel extends javax.swing.JPanel { private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed if (getPlayerType() != PlayerType.HUMAN) { this.newPlayerPanel.setVisible(true); - } else { + this.newPlayerPanel.setPlayerName("Computer " + this.lblPlayerNum.getText().charAt(this.lblPlayerNum.getText().length() - 1),true,true); + } + else { this.newPlayerPanel.setVisible(false); } this.revalidate();