diff --git a/src/main/java/forge/gui/GuiChoose.java b/src/main/java/forge/gui/GuiChoose.java
index bdfe19f9dec..714165b3d88 100644
--- a/src/main/java/forge/gui/GuiChoose.java
+++ b/src/main/java/forge/gui/GuiChoose.java
@@ -89,41 +89,20 @@ public class GuiChoose {
}
// returned Object will never be null
- /**
- *
- * getChoices.
- *
- *
- * @param
- * a T object.
- * @param message
- * a {@link java.lang.String} object.
- * @param min
- * a int.
- * @param max
- * a int.
- * @param choices
- * a T object.
- * @return a {@link java.util.List} object.
- */
public static List getChoices(final String message, final int min, final int max, final T[] choices) {
- final ListChooser c = new ListChooser(message, min, max, choices);
- return getChoices(c);
+ return getChoices(message, min, max, Arrays.asList(choices));
}
public static List getChoices(final String message, final int min, final int max, final Collection choices) {
- final ListChooser c = new ListChooser(message, min, max, choices);
- return getChoices(c);
- }
-
- // Nothing to choose here. Code uses this to just show a card.
- public static Card show(final String message, final Card singleChoice) {
- List choices = new ArrayList();
- choices.add(singleChoice);
- return one(message, choices);
- }
-
- private static List getChoices(final ListChooser c) {
+ if (null == choices || choices.isEmpty()) {
+ if (0 == min) {
+ return new ArrayList();
+ } else {
+ throw new RuntimeException("choice required from empty list");
+ }
+ }
+
+ ListChooser c = new ListChooser(message, min, max, choices);
final JList list = c.getJList();
list.addListSelectionListener(new ListSelectionListener() {
@Override
@@ -142,7 +121,14 @@ public class GuiChoose {
c.show();
GuiUtils.clearPanelSelections();
return c.getSelectedValues();
- } // getChoice()
+ }
+
+ // Nothing to choose here. Code uses this to just show a card.
+ public static Card show(final String message, final Card singleChoice) {
+ List choices = new ArrayList();
+ choices.add(singleChoice);
+ return one(message, choices);
+ }
public static List order(final String title, final String top, int remainingObjects,
final List sourceChoices, List destChoices, Card referenceCard) {
diff --git a/src/main/java/forge/gui/ListChooser.java b/src/main/java/forge/gui/ListChooser.java
index 92a5dfe9de5..aa25d450207 100644
--- a/src/main/java/forge/gui/ListChooser.java
+++ b/src/main/java/forge/gui/ListChooser.java
@@ -24,7 +24,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.util.AbstractList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -84,10 +83,6 @@ public class ListChooser {
private JOptionPane optionPane;
private Action ok, cancel;
- public ListChooser(final String title, final int minChoices, final int maxChoices, final T[] list) {
- this(title, minChoices, maxChoices, Arrays.asList(list));
- }
-
public ListChooser(final String title, final int minChoices, final int maxChoices, final Collection list) {
this.title = title;
this.minChoices = minChoices;
@@ -125,7 +120,7 @@ public class ListChooser {
}
/** @return boolean */
- public synchronized boolean show() {
+ public boolean show() {
return show(list.get(0));
}
@@ -135,7 +130,7 @@ public class ListChooser {
* @param index0 index to select when shown
* @return a boolean.
*/
- public synchronized boolean show(T item) {
+ public boolean show(T item) {
if (this.called) {
throw new IllegalStateException("Already shown");
}
diff --git a/src/main/java/forge/gui/match/ControlWinLose.java b/src/main/java/forge/gui/match/ControlWinLose.java
index 08b0d092680..0cba45494ff 100644
--- a/src/main/java/forge/gui/match/ControlWinLose.java
+++ b/src/main/java/forge/gui/match/ControlWinLose.java
@@ -141,6 +141,7 @@ public class ControlWinLose {
cDeck.getMain().remove(toRemove);
if ( cDeck != oDeck )
oDeck.getMain().remove(toRemove);
+ losses.add(toRemove);
}
}