forked from External/mage
added tournaments - drafts are now a variant of tournament
This commit is contained in:
parent
78e60ce457
commit
ffc7b5bfd8
88 changed files with 3768 additions and 311 deletions
|
|
@ -34,30 +34,15 @@
|
|||
|
||||
package mage.client.table;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.deck.generator.DeckGenerator;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.gui.ColorsChooser;
|
||||
import mage.sets.Sets;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -119,8 +104,8 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
// </editor-fold>//GEN-END:initComponents
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
||||
// </editor-fold>
|
||||
private void initComponents() {
|
||||
|
||||
lblPlayerName = new javax.swing.JLabel();
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnNewTable" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="btnNewDraft" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnNewTournament" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnQuickStart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="450" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="416" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnNewTable" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnQuickStart" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnNewDraft" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnNewTournament" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="16" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -78,12 +78,12 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnQuickStartActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnNewDraft">
|
||||
<Component class="javax.swing.JButton" name="btnNewTournament">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="New Draft"/>
|
||||
<Property name="text" type="java.lang.String" value="New Tournament"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnNewDraftActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnNewTournamentActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ import java.awt.event.ActionListener;
|
|||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.client.dialog.NewTournamentDialog;
|
||||
import mage.game.draft.DraftOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -73,6 +76,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
private TablesWatchdog tablesWatchdog = new TablesWatchdog();
|
||||
private JoinTableDialog joinTableDialog;
|
||||
private NewTableDialog newTableDialog;
|
||||
private NewTournamentDialog newTournamentDialog;
|
||||
private TableWaitingDialog tableWaitingDialog;
|
||||
private Session session;
|
||||
|
||||
|
|
@ -99,7 +103,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
|
||||
joinTableDialog.showDialog(roomId, tableId);
|
||||
if (joinTableDialog.isJoined())
|
||||
tableWaitingDialog.showDialog(roomId, tableId);
|
||||
tableWaitingDialog.showDialog(roomId, tableId, false);
|
||||
} else if (state.equals("Watch")) {
|
||||
logger.info("Watching table " + tableId);
|
||||
if (!session.watchTable(roomId, tableId))
|
||||
|
|
@ -152,6 +156,10 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
newTableDialog = new NewTableDialog();
|
||||
MageFrame.getDesktop().add(newTableDialog);
|
||||
}
|
||||
if (newTournamentDialog == null) {
|
||||
newTournamentDialog = new NewTournamentDialog();
|
||||
MageFrame.getDesktop().add(newTournamentDialog);
|
||||
}
|
||||
if (joinTableDialog == null) {
|
||||
joinTableDialog = new JoinTableDialog();
|
||||
MageFrame.getDesktop().add(joinTableDialog);
|
||||
|
|
@ -201,7 +209,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
jPanel1 = new javax.swing.JPanel();
|
||||
btnNewTable = new javax.swing.JButton();
|
||||
btnQuickStart = new javax.swing.JButton();
|
||||
btnNewDraft = new javax.swing.JButton();
|
||||
btnNewTournament = new javax.swing.JButton();
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
chatPanel = new mage.client.chat.ChatPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
|
|
@ -221,14 +229,12 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
}
|
||||
});
|
||||
|
||||
btnNewDraft.setText("New Draft");
|
||||
btnNewDraft.addActionListener(new java.awt.event.ActionListener() {
|
||||
btnNewTournament.setText("New Tournament");
|
||||
btnNewTournament.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnNewDraftActionPerformed(evt);
|
||||
btnNewTournamentActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
//FIXME: removed on released 0.6 version
|
||||
btnNewDraft.setVisible(false);
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
|
|
@ -238,10 +244,10 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
.addContainerGap()
|
||||
.addComponent(btnNewTable)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(btnNewDraft)
|
||||
.addComponent(btnNewTournament)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnQuickStart)
|
||||
.addContainerGap(450, Short.MAX_VALUE))
|
||||
.addContainerGap(416, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -250,7 +256,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnNewTable)
|
||||
.addComponent(btnQuickStart)
|
||||
.addComponent(btnNewDraft))
|
||||
.addComponent(btnNewTournament))
|
||||
.addContainerGap(16, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
|
|
@ -284,7 +290,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
private void btnNewTableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewTableActionPerformed
|
||||
newTableDialog.showDialog(roomId);
|
||||
if (newTableDialog.getTable() != null) {
|
||||
tableWaitingDialog.showDialog(roomId, newTableDialog.getTable().getTableId());
|
||||
tableWaitingDialog.showDialog(roomId, newTableDialog.getTable().getTableId(), false);
|
||||
}
|
||||
}//GEN-LAST:event_btnNewTableActionPerformed
|
||||
|
||||
|
|
@ -318,9 +324,12 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
}
|
||||
}//GEN-LAST:event_btnQuickStartActionPerformed
|
||||
|
||||
private void btnNewDraftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewDraftActionPerformed
|
||||
|
||||
}//GEN-LAST:event_btnNewDraftActionPerformed
|
||||
private void btnNewTournamentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewTournamentActionPerformed
|
||||
newTournamentDialog.showDialog(roomId);
|
||||
if (newTournamentDialog.getTable() != null) {
|
||||
tableWaitingDialog.showDialog(roomId, newTournamentDialog.getTable().getTableId(), true);
|
||||
}
|
||||
}//GEN-LAST:event_btnNewTournamentActionPerformed
|
||||
|
||||
private void handleError(Exception ex) {
|
||||
logger.log(Level.SEVERE, "Error loading deck", ex);
|
||||
|
|
@ -329,8 +338,8 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnNewDraft;
|
||||
private javax.swing.JButton btnNewTable;
|
||||
private javax.swing.JButton btnNewTournament;
|
||||
private javax.swing.JButton btnQuickStart;
|
||||
private mage.client.chat.ChatPanel chatPanel;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPlayerNum" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbPlayerType" min="-2" pref="175" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlPlayerName" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="lblPlayerNum" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbPlayerType" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="pnlPlayerName" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="cbPlayerType"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Type:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="cbPlayerType">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbPlayerTypeActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblPlayerNum">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="11" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Player Num:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="pnlPlayerName">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPlayerName" pref="189" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="txtPlayerName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="txtPlayerName">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Name:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TournamentPlayerPanel.java
|
||||
*
|
||||
* Created on Jan 28, 2011, 1:50:29 PM
|
||||
*/
|
||||
|
||||
package mage.client.table;
|
||||
|
||||
import java.util.UUID;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.remote.Session;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TournamentPlayerPanel extends javax.swing.JPanel {
|
||||
|
||||
private Session session;
|
||||
|
||||
/** Creates new form TournamentPlayerPanel */
|
||||
public TournamentPlayerPanel() {
|
||||
initComponents();
|
||||
this.pnlPlayerName.setVisible(false);
|
||||
}
|
||||
|
||||
public void init(int playerNum) {
|
||||
session = MageFrame.getSession();
|
||||
cbPlayerType.setModel(new DefaultComboBoxModel(session.getPlayerTypes()));
|
||||
this.lblPlayerNum.setText("Player " + playerNum);
|
||||
}
|
||||
|
||||
public String getPlayerType() {
|
||||
return (String) this.cbPlayerType.getSelectedItem();
|
||||
}
|
||||
|
||||
public boolean joinTournamentTable(UUID roomId, UUID tableId) {
|
||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
||||
return session.joinTournamentTable(roomId, tableId, this.txtPlayerName.getText());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
cbPlayerType = new javax.swing.JComboBox();
|
||||
lblPlayerNum = new javax.swing.JLabel();
|
||||
pnlPlayerName = new javax.swing.JPanel();
|
||||
txtPlayerName = new javax.swing.JTextField();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
|
||||
jLabel1.setLabelFor(cbPlayerType);
|
||||
jLabel1.setText("Type:");
|
||||
|
||||
cbPlayerType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
cbPlayerType.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cbPlayerTypeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblPlayerNum.setText("Player Num:");
|
||||
|
||||
jLabel2.setText("Name:");
|
||||
|
||||
javax.swing.GroupLayout pnlPlayerNameLayout = new javax.swing.GroupLayout(pnlPlayerName);
|
||||
pnlPlayerName.setLayout(pnlPlayerNameLayout);
|
||||
pnlPlayerNameLayout.setHorizontalGroup(
|
||||
pnlPlayerNameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlPlayerNameLayout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
|
||||
);
|
||||
pnlPlayerNameLayout.setVerticalGroup(
|
||||
pnlPlayerNameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlPlayerNameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblPlayerNum)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbPlayerType, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(lblPlayerNum)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(cbPlayerType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(pnlPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
|
||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
||||
this.pnlPlayerName.setVisible(true);
|
||||
if (this.txtPlayerName.getText().length() == 0) {
|
||||
this.txtPlayerName.setText("Computer " + this.lblPlayerNum.getText());
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.pnlPlayerName.setVisible(false);
|
||||
}
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}//GEN-LAST:event_cbPlayerTypeActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JComboBox cbPlayerType;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel lblPlayerNum;
|
||||
private javax.swing.JPanel pnlPlayerName;
|
||||
private javax.swing.JTextField txtPlayerName;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue