Add land dialog is now also shown during free deck building. Added a set selection drop down box to select the set the lands are used from.

This commit is contained in:
LevelX2 2015-06-04 19:37:54 +02:00
parent 1456e0172c
commit 3b9cb1dc6e
4 changed files with 161 additions and 95 deletions

View file

@ -186,6 +186,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
break; break;
case FREE_BUILDING: case FREE_BUILDING:
this.btnSubmit.setVisible(false); this.btnSubmit.setVisible(false);
this.btnAddLand.setVisible(true);
this.cardSelector.loadCards(this.bigCard); this.cardSelector.loadCards(this.bigCard);
//this.cardTableSelector.loadCards(this.bigCard); //this.cardTableSelector.loadCards(this.bigCard);
this.btnExit.setVisible(true); this.btnExit.setVisible(true);
@ -796,7 +797,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
private void btnAddLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddLandActionPerformed private void btnAddLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddLandActionPerformed
AddLandDialog addLand = new AddLandDialog(); AddLandDialog addLand = new AddLandDialog();
addLand.showDialog(deck); addLand.showDialog(deck, mode);
refreshDeck(); refreshDeck();
}//GEN-LAST:event_btnAddLandActionPerformed }//GEN-LAST:event_btnAddLandActionPerformed

View file

@ -29,9 +29,9 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
@ -39,34 +39,43 @@
<Component id="lblIsland" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblIsland" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblMountain" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblMountain" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblForest" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblForest" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblLandSet" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="spnMountain" pref="85" max="32767" attributes="0"/> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spnIsland" max="32767" attributes="0"/> <Component id="spnMountain" pref="85" max="32767" attributes="0"/>
<Component id="spnForest" max="32767" attributes="0"/> <Component id="spnIsland" max="32767" attributes="0"/>
<Component id="spnForest" max="32767" attributes="0"/>
</Group>
<Component id="cbLandSet" min="-2" pref="207" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Component id="lblPains" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="1" attributes="0">
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<Component id="spnPlains" max="32767" attributes="0"/> <Component id="lblSwamp" min="-2" max="-2" attributes="0"/>
</Group> <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Component id="spnSwamp" max="32767" attributes="0"/>
<Component id="lblSwamp" min="-2" max="-2" attributes="0"/> </Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<Component id="spnSwamp" max="32767" attributes="0"/> <Component id="lblPains" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Component id="spnPlains" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="122" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace min="-2" pref="114" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="btnCancel" min="-2" max="-2" attributes="0"/> <Component id="btnCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="btnAutoAdd" min="-2" max="-2" attributes="0"/> <Component id="btnAutoAdd" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="btnAdd" min="-2" max="-2" attributes="0"/> <Component id="btnAdd" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="40" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</Group> </Group>
@ -75,6 +84,11 @@
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cbLandSet" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblLandSet" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="lblForest" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lblForest" alignment="3" min="-2" max="-2" attributes="0"/>
@ -100,7 +114,7 @@
<Component id="lblSwamp" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lblSwamp" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnSwamp" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="spnSwamp" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace pref="38" max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="btnAdd" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="btnAdd" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
@ -112,6 +126,23 @@
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Component class="javax.swing.JLabel" name="lblLandSet">
<Properties>
<Property name="text" type="java.lang.String" value="Set"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbLandSet">
<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>
</Component>
<Component class="javax.swing.JLabel" name="lblForest"> <Component class="javax.swing.JLabel" name="lblForest">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Forest"/> <Property name="text" type="java.lang.String" value="Forest"/>
@ -124,6 +155,11 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblIsland">
<Properties>
<Property name="text" type="java.lang.String" value="Island"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spnIsland"> <Component class="javax.swing.JSpinner" name="spnIsland">
<Properties> <Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor"> <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
@ -131,9 +167,16 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblIsland"> <Component class="javax.swing.JLabel" name="lblMountain">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Island"/> <Property name="text" type="java.lang.String" value="Mountain"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spnMountain">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblPains"> <Component class="javax.swing.JLabel" name="lblPains">
@ -148,16 +191,9 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JSpinner" name="spnMountain"> <Component class="javax.swing.JLabel" name="lblSwamp">
<Properties> <Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor"> <Property name="text" type="java.lang.String" value="Swamp"/>
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblMountain">
<Properties>
<Property name="text" type="java.lang.String" value="Mountain"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JSpinner" name="spnSwamp"> <Component class="javax.swing.JSpinner" name="spnSwamp">
@ -167,11 +203,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblSwamp">
<Properties>
<Property name="text" type="java.lang.String" value="Swamp"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnAdd"> <Component class="javax.swing.JButton" name="btnAdd">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Add"/> <Property name="text" type="java.lang.String" value="Add"/>

View file

@ -31,6 +31,9 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import mage.Mana; import mage.Mana;
import mage.cards.Card; import mage.cards.Card;
@ -41,6 +44,7 @@ import mage.cards.repository.CardRepository;
import mage.cards.repository.ExpansionInfo; import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository; import mage.cards.repository.ExpansionRepository;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.constants.Constants.DeckEditorMode;
import mage.constants.Rarity; import mage.constants.Rarity;
/** /**
@ -60,45 +64,49 @@ public class AddLandDialog extends MageDialog {
this.setModal(true); this.setModal(true);
} }
public void showDialog(Deck deck) { public void showDialog(Deck deck, DeckEditorMode mode) {
this.deck = deck; this.deck = deck;
SortedSet<String> landSets = new TreeSet<>();
// decide from which sets basic lands are taken from if (!mode.equals(DeckEditorMode.FREE_BUILDING)) {
for (String setCode :deck.getExpansionSetCodes()) { // decide from which sets basic lands are taken from
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null && expansionInfo.hasBasicLands()) {
this.setCodesland.add(expansionInfo.getCode());
}
}
// if sets have no basic land, take land from block
if (this.setCodesland.isEmpty()) {
for (String setCode :deck.getExpansionSetCodes()) { for (String setCode :deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode); ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null) { if (expansionInfo != null && expansionInfo.hasBasicLands()) {
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName()); this.setCodesland.add(expansionInfo.getCode());
for (ExpansionInfo blockSet: blockSets) { landSets.add(expansionInfo.getName());
if (blockSet.hasBasicLands()) { }
this.setCodesland.add(blockSet.getCode()); }
// if sets have no basic land, take land from block
if (this.setCodesland.isEmpty()) {
for (String setCode :deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null) {
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet: blockSets) {
if (blockSet.hasBasicLands()) {
this.setCodesland.add(blockSet.getCode());
landSets.add(blockSet.getName());
}
} }
} }
} }
} }
} }
// if still no set with lands found, take one by random // if still no set with lands found, add list of all available
if (this.setCodesland.isEmpty()) { if (this.setCodesland.isEmpty()) {
// if sets have no basic lands and also it has no parent or parent has no lands get last set with lands
// select a set with basic lands by random
Random generator = new Random();
List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate(); List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate();
if (basicLandSets.size() > 0) { for (ExpansionInfo expansionInfo: basicLandSets) {
this.setCodesland.add(basicLandSets.get(generator.nextInt(basicLandSets.size())).getCode()); landSets.add(expansionInfo.getName());
} }
} }
if (landSets.isEmpty()) {
if (this.setCodesland.isEmpty()) {
throw new IllegalArgumentException("No set with basic land was found"); throw new IllegalArgumentException("No set with basic land was found");
} }
if(landSets.size() > 1) {
landSets.add("<Random lands>");
}
cbLandSet.setModel(new DefaultComboBoxModel(landSets.toArray()));
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER); MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
this.setVisible(true); this.setVisible(true);
@ -106,14 +114,22 @@ public class AddLandDialog extends MageDialog {
private void addLands(String landName, int number) { private void addLands(String landName, int number) {
Random random = new Random(); Random random = new Random();
String landSetName = (String) cbLandSet.getSelectedItem();
CardCriteria criteria = new CardCriteria(); CardCriteria criteria = new CardCriteria();
if (!setCodesland.isEmpty()) { if (landSetName.equals("<Random lands>")) {
criteria.setCodes(setCodesland.toArray(new String[setCodesland.size()])); criteria.setCodes(setCodesland.toArray(new String[setCodesland.size()]));
} else {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByName(landSetName);
if (expansionInfo == null) {
throw new IllegalArgumentException("Code of Set " + landSetName + " not found");
}
criteria.setCodes(expansionInfo.getCode());
} }
criteria.rarities(Rarity.LAND).name(landName); criteria.rarities(Rarity.LAND).name(landName);
List<CardInfo> cards = CardRepository.instance.findCards(criteria); List<CardInfo> cards = CardRepository.instance.findCards(criteria);
if (cards.isEmpty()) { if (cards.isEmpty()) {
return; throw new IllegalArgumentException("No basic lands found in Set: " + landSetName);
} }
for (int i = 0; i < number; i++) { for (int i = 0; i < number; i++) {
@ -132,16 +148,18 @@ public class AddLandDialog extends MageDialog {
private void initComponents() { private void initComponents() {
jButton2 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
lblLandSet = new javax.swing.JLabel();
cbLandSet = new javax.swing.JComboBox();
lblForest = new javax.swing.JLabel(); lblForest = new javax.swing.JLabel();
spnForest = new javax.swing.JSpinner(); spnForest = new javax.swing.JSpinner();
spnIsland = new javax.swing.JSpinner();
lblIsland = new javax.swing.JLabel(); lblIsland = new javax.swing.JLabel();
spnIsland = new javax.swing.JSpinner();
lblMountain = new javax.swing.JLabel();
spnMountain = new javax.swing.JSpinner();
lblPains = new javax.swing.JLabel(); lblPains = new javax.swing.JLabel();
spnPlains = new javax.swing.JSpinner(); spnPlains = new javax.swing.JSpinner();
spnMountain = new javax.swing.JSpinner();
lblMountain = new javax.swing.JLabel();
spnSwamp = new javax.swing.JSpinner();
lblSwamp = new javax.swing.JLabel(); lblSwamp = new javax.swing.JLabel();
spnSwamp = new javax.swing.JSpinner();
btnAdd = new javax.swing.JButton(); btnAdd = new javax.swing.JButton();
btnCancel = new javax.swing.JButton(); btnCancel = new javax.swing.JButton();
btnAutoAdd = new javax.swing.JButton(); btnAutoAdd = new javax.swing.JButton();
@ -150,26 +168,30 @@ public class AddLandDialog extends MageDialog {
setTitle("Add Land"); setTitle("Add Land");
lblLandSet.setText("Set");
cbLandSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
lblForest.setText("Forest"); lblForest.setText("Forest");
spnForest.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); spnForest.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
lblIsland.setText("Island");
spnIsland.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); spnIsland.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
lblIsland.setText("Island"); lblMountain.setText("Mountain");
spnMountain.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
lblPains.setText("Plains"); lblPains.setText("Plains");
spnPlains.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); spnPlains.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
spnMountain.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); lblSwamp.setText("Swamp");
lblMountain.setText("Mountain");
spnSwamp.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); spnSwamp.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
lblSwamp.setText("Swamp");
btnAdd.setText("Add"); btnAdd.setText("Add");
btnAdd.addActionListener(new java.awt.event.ActionListener() { btnAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -197,40 +219,50 @@ public class AddLandDialog extends MageDialog {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblIsland) .addComponent(lblIsland)
.addComponent(lblMountain) .addComponent(lblMountain)
.addComponent(lblForest)) .addComponent(lblForest)
.addComponent(lblLandSet))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spnMountain, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spnIsland) .addComponent(spnMountain, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.addComponent(spnForest))) .addComponent(spnIsland)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(spnForest))
.addComponent(lblPains) .addComponent(cbLandSet, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(21, 21, 21) .addGroup(layout.createSequentialGroup()
.addComponent(spnPlains)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(lblSwamp) .addComponent(lblSwamp)
.addGap(14, 14, 14) .addGap(14, 14, 14)
.addComponent(spnSwamp))) .addComponent(spnSwamp))
.addGap(114, 114, 114)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(lblPains)
.addGap(21, 21, 21)
.addComponent(spnPlains)))
.addGap(122, 122, 122)))
.addContainerGap())
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(btnCancel) .addComponent(btnCancel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnAutoAdd) .addComponent(btnAutoAdd)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnAdd) .addComponent(btnAdd)
.addGap(0, 40, Short.MAX_VALUE)))) .addGap(0, 0, Short.MAX_VALUE))))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbLandSet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblLandSet))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblForest) .addComponent(lblForest)
.addComponent(spnForest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(spnForest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@ -250,7 +282,7 @@ public class AddLandDialog extends MageDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblSwamp) .addComponent(lblSwamp)
.addComponent(spnSwamp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(spnSwamp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnAdd) .addComponent(btnAdd)
.addComponent(btnCancel) .addComponent(btnCancel)
@ -322,9 +354,11 @@ public class AddLandDialog extends MageDialog {
private javax.swing.JButton btnAdd; private javax.swing.JButton btnAdd;
private javax.swing.JButton btnAutoAdd; private javax.swing.JButton btnAutoAdd;
private javax.swing.JButton btnCancel; private javax.swing.JButton btnCancel;
private javax.swing.JComboBox cbLandSet;
private javax.swing.JButton jButton2; private javax.swing.JButton jButton2;
private javax.swing.JLabel lblForest; private javax.swing.JLabel lblForest;
private javax.swing.JLabel lblIsland; private javax.swing.JLabel lblIsland;
private javax.swing.JLabel lblLandSet;
private javax.swing.JLabel lblMountain; private javax.swing.JLabel lblMountain;
private javax.swing.JLabel lblPains; private javax.swing.JLabel lblPains;
private javax.swing.JLabel lblSwamp; private javax.swing.JLabel lblSwamp;

View file

@ -78,7 +78,7 @@ public class ColorsChooser extends JComboBox implements ListCellRenderer {
} }
private void drawOn(JPanel panel, String value) { private void drawOn(JPanel panel, String value) {
List<Image> images = new ArrayList<Image>(); List<Image> images = new ArrayList<>();
value = value.toUpperCase(); value = value.toUpperCase();
for (int i = 0; i < value.length(); i++) { for (int i = 0; i < value.length(); i++) {
char symbol = value.charAt(i); char symbol = value.charAt(i);