chordMenuToItemLut.clear();
scaleMenuToItemLut.clear();
ArrayList<LabeledInteger> labels;
Iterator<LabeledInteger> labelIterator;
LabeledInteger labeledInteger;
if (instrumentType == PIANO_TYPE)
{
labels = piano.getKeyLabels();
JRadioButtonMenuItem firstMenuItem;
labelIterator = labels.iterator();
firstMenuItem = null;
while (labelIterator.hasNext())
{
labeledInteger = labelIterator.next();
menuItem = new JRadioButtonMenuItem(labeledInteger.getLabel());
menuItem.addActionListener(actionPerformed);
keys.add(menuItem);
keyMenuToItemLut.put(menuItem, labeledInteger);
if (firstMenuItem == null)
firstMenuItem = menuItem;
}
labels = piano.getChordLabels();
labelIterator = labels.iterator();
firstMenuItem = null;
while (labelIterator.hasNext())
{
labeledInteger = labelIterator.next();
menuItem = new JRadioButtonMenuItem(labeledInteger.getLabel());
menuItem.addActionListener(actionPerformed);
chords.add(menuItem);
chordMenuToItemLut.put(menuItem, labeledInteger);
if (firstMenuItem == null)
firstMenuItem = menuItem;
}
labels = piano.getScaleLabels();
labelIterator = labels.iterator();
firstMenuItem = null;
while (labelIterator.hasNext())
{
labeledInteger = labelIterator.next();
menuItem = new JRadioButtonMenuItem(labeledInteger.getLabel());
menuItem.addActionListener(actionPerformed);
scales.add(menuItem);
scaleMenuToItemLut.put(menuItem, labeledInteger);
if (firstMenuItem == null)