import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
if (!create && features.size() > 1)
{
/*
- * more than one feature at selected position - add a drop-down
- * to choose the feature to amend
+ * more than one feature at selected position -
+ * add a drop-down to choose the feature to amend
+ * space pad text if necessary to make entries distinct
*/
gridPanel = new JPanel(new GridLayout(4, 1));
JPanel choosePanel = new JPanel();
.getString("label.select_feature")
+ ":"));
final JComboBox<String> overlaps = new JComboBox<String>();
+ List<String> added = new ArrayList<>();
for (SequenceFeature sf : features)
{
- String text = sf.getType() + "/" + sf.getBegin() + "-"
- + sf.getEnd() + " (" + sf.getFeatureGroup() + ")";
+ String text = String.format("%s/%d-%d (%s)", sf.getType(),
+ sf.getBegin(), sf.getEnd(), sf.getFeatureGroup());
+ while (added.contains(text))
+ {
+ text += " ";
+ }
overlaps.addItem(text);
+ added.add(text);
}
choosePanel.add(overlaps);