From aef4ee329c6af54eca43081035a5c1f87153dec2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 20 Sep 2012 15:19:38 +0200 Subject: [PATCH] Sort identities by nickname. --- src/main/java/de/todesbaum/jsite/gui/KeyDialog.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- 2.7.4