From: David ‘Bombe’ Roden Date: Thu, 20 Sep 2012 13:19:38 +0000 (+0200) Subject: Sort identities by nickname. X-Git-Tag: 0.11^2~10^2~3 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=aef4ee329c6af54eca43081035a5c1f87153dec2;p=jSite.git Sort identities by nickname. --- diff --git a/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java b/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java index 2906175..88eb2ca 100644 --- a/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java +++ b/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java @@ -36,6 +36,8 @@ import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import javax.swing.AbstractAction; @@ -191,6 +193,13 @@ public class KeyDialog extends JDialog { synchronized (this.ownIdentities) { this.ownIdentities.clear(); this.ownIdentities.addAll(ownIdentities); + Collections.sort(this.ownIdentities, new Comparator() { + + @Override + public int compare(OwnIdentity leftOwnIdentity, OwnIdentity rightOwnIdentity) { + return leftOwnIdentity.getNickname().compareToIgnoreCase(rightOwnIdentity.getNickname()); + } + }); } int selectedIndex = -1; int index = 0;