From 4efdb15f9c8ea20a57c59aa6176715abc8ef9d0c Mon Sep 17 00:00:00 2001 From: magenoxx Date: Tue, 21 Dec 2010 13:40:25 +0300 Subject: [PATCH] Sort set names in deck editor (by name). --- .../java/mage/client/deckeditor/CardSelector.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index b2be8396a4..cc69df88c6 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -37,10 +37,7 @@ package mage.client.deckeditor; import java.awt.Cursor; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import javax.swing.DefaultComboBoxModel; import mage.Constants.CardType; import mage.cards.Card; @@ -75,7 +72,14 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene public void loadCards(BigCard bigCard) { this.bigCard = bigCard; - cbExpansionSet.setModel(new DefaultComboBoxModel(Sets.getInstance().values().toArray())); + Object[] l = Sets.getInstance().values().toArray(); + Arrays.sort(l, new Comparator() { + @Override + public int compare(Object o1, Object o2) { + return ((ExpansionSet)o1).getName().compareTo(((ExpansionSet)o2).getName()); + } + }); + cbExpansionSet.setModel(new DefaultComboBoxModel(l)); // cbExpansionSet.insertItemAt("All sets", 0); cbExpansionSet.setSelectedIndex(0); filter.setUseColor(true);