import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.Map;
-import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
private boolean showAutoCalculatedAbove = false;
- private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
+ private Map<KeyStroke, ActionListener> accelerators = new HashMap<KeyStroke, ActionListener>();
public GAlignFrame()
{
JMenuItem item = new JMenuItem(
jalview.io.FormatAdapter.WRITEABLE_FORMATS[i]);
- item.addActionListener(new java.awt.event.ActionListener()
+ item.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
reload.setMnemonic('R');
}
- // setKeyBindings();
-
if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
{
java.util.Enumeration userColours = jalview.gui.UserDefinedColours
}
- /**
- * Set key bindings (recommended for Swing over key accelerators).
- */
- private void setKeyBindings()
- {
- /*
- * Experiment using Cmd-Alt/K (unmapped) as a synonym for Cmd-Alt/I (invert
- * column selection)
- */
- this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
- KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.ALT_MASK, false),
- "INV_SEQ_SEL");
- this.getActionMap().put("INV_SEQ_SEL", new AbstractAction()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- invertColSel_actionPerformed(null);
- }
- });
- }
-
public void setColourSelected(String defaultColour)
{
private void jbInit() throws Exception
{
fileMenu.setText(MessageManager.getString("action.file"));
+
saveAs.setText(MessageManager.getString("action.save_as") + "...");
- KeyStroke keyStroke = javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false);
- saveAs.setAccelerator(keyStroke);
- accelerators.put(keyStroke, saveAs);
- saveAs.addActionListener(new ActionListener()
+ ActionListener al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
saveAs_actionPerformed(e);
}
- });
+ };
+ KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ addMenuActionAndAccelerator(keyStroke, saveAs, al);
+
closeMenuItem.setText(MessageManager.getString("action.close"));
- closeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_W, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- closeMenuItem.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
closeMenuItem_actionPerformed(false);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
+
editMenu.setText(MessageManager.getString("action.edit"));
viewMenu.setText(MessageManager.getString("action.view"));
annotationsMenu.setText(MessageManager.getString("action.annotations"));
colourMenu.setText(MessageManager.getString("action.colour"));
calculateMenu.setText(MessageManager.getString("action.calculate"));
webService.setText(MessageManager.getString("action.web_service"));
+
selectAllSequenceMenuItem.setText(MessageManager
.getString("action.select_all"));
- selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_A, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- selectAllSequenceMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- selectAllSequenceMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ selectAllSequenceMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al);
+
deselectAllSequenceMenuItem.setText(MessageManager
.getString("action.deselect_all"));
- deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false));
- deselectAllSequenceMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- deselectAllSequenceMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ deselectAllSequenceMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al);
+
invertSequenceMenuItem.setText(MessageManager
.getString("action.invert_sequence_selection"));
- keyStroke = javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_I, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false);
- invertSequenceMenuItem.setAccelerator(keyStroke);
- accelerators.put(keyStroke, invertSequenceMenuItem);
- invertSequenceMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- invertSequenceMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ invertSequenceMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al);
+
grpsFromSelection.setText(MessageManager
.getString("action.make_groups_selection"));
- grpsFromSelection.addActionListener(new java.awt.event.ActionListener()
+ grpsFromSelection.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
.getString("action.view_flanking_regions"));
expandAlignment.setToolTipText(MessageManager
.getString("label.view_flanking_regions"));
- expandAlignment.addActionListener(new java.awt.event.ActionListener()
+ expandAlignment.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
remove2LeftMenuItem.setText(MessageManager
.getString("action.remove_left"));
- remove2LeftMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_L, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- remove2LeftMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- remove2LeftMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ remove2LeftMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al);
+
remove2RightMenuItem.setText(MessageManager
.getString("action.remove_right"));
- remove2RightMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_R, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- remove2RightMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- remove2RightMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ remove2RightMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al);
+
removeGappedColumnMenuItem.setText(MessageManager
.getString("action.remove_empty_columns"));
- removeGappedColumnMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_E, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- removeGappedColumnMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- removeGappedColumnMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ removeGappedColumnMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al);
+
removeAllGapsMenuItem.setText(MessageManager
.getString("action.remove_all_gaps"));
- removeAllGapsMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_E, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false));
- removeAllGapsMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- removeAllGapsMenuItem_actionPerformed(e);
- }
- });
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ removeAllGapsMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al);
+
justifyLeftMenuItem.setText(MessageManager
.getString("action.left_justify_alignment"));
- justifyLeftMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- justifyLeftMenuItem_actionPerformed(e);
- }
- });
+ justifyLeftMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ justifyLeftMenuItem_actionPerformed(e);
+ }
+ });
justifyRightMenuItem.setText(MessageManager
.getString("action.right_justify_alignment"));
- justifyRightMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- justifyRightMenuItem_actionPerformed(e);
- }
- });
+ justifyRightMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ justifyRightMenuItem_actionPerformed(e);
+ }
+ });
viewBoxesMenuItem.setText(MessageManager.getString("action.boxes"));
viewBoxesMenuItem.setState(true);
- viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener()
+ viewBoxesMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
viewTextMenuItem.setText(MessageManager.getString("action.text"));
viewTextMenuItem.setState(true);
- viewTextMenuItem.addActionListener(new java.awt.event.ActionListener()
+ viewTextMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
showNonconservedMenuItem.setText(MessageManager
.getString("label.show_non_conversed"));
showNonconservedMenuItem.setState(false);
- showNonconservedMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- showUnconservedMenuItem_actionPerformed(e);
- }
- });
+ showNonconservedMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showUnconservedMenuItem_actionPerformed(e);
+ }
+ });
sortPairwiseMenuItem.setText(MessageManager
.getString("action.by_pairwise_id"));
- sortPairwiseMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- sortPairwiseMenuItem_actionPerformed(e);
- }
- });
+ sortPairwiseMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sortPairwiseMenuItem_actionPerformed(e);
+ }
+ });
sortIDMenuItem.setText(MessageManager.getString("action.by_id"));
- sortIDMenuItem.addActionListener(new java.awt.event.ActionListener()
+ sortIDMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
sortLengthMenuItem
.setText(MessageManager.getString("action.by_length"));
- sortLengthMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- sortLengthMenuItem_actionPerformed(e);
- }
- });
+ sortLengthMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sortLengthMenuItem_actionPerformed(e);
+ }
+ });
sortGroupMenuItem.setText(MessageManager.getString("action.by_group"));
- sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
+ sortGroupMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
sortGroupMenuItem_actionPerformed(e);
}
});
- removeRedundancyMenuItem.setText(MessageManager
- .getString("action.remove_redundancy").concat("..."));
- removeRedundancyMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_D, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- removeRedundancyMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- removeRedundancyMenuItem_actionPerformed(e);
- }
- });
+
+ removeRedundancyMenuItem.setText(MessageManager.getString(
+ "action.remove_redundancy").concat("..."));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ removeRedundancyMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al);
+
pairwiseAlignmentMenuItem.setText(MessageManager
.getString("action.pairwise_alignment"));
- pairwiseAlignmentMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- pairwiseAlignmentMenuItem_actionPerformed(e);
- }
- });
+ pairwiseAlignmentMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ pairwiseAlignmentMenuItem_actionPerformed(e);
+ }
+ });
PCAMenuItem.setText(MessageManager
.getString("label.principal_component_analysis"));
- PCAMenuItem.addActionListener(new java.awt.event.ActionListener()
+ PCAMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
averageDistanceTreeMenuItem.setText(MessageManager
.getString("label.average_distance_identity"));
- averageDistanceTreeMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- averageDistanceTreeMenuItem_actionPerformed(e);
- }
- });
+ averageDistanceTreeMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ averageDistanceTreeMenuItem_actionPerformed(e);
+ }
+ });
neighbourTreeMenuItem.setText(MessageManager
.getString("label.neighbour_joining_identity"));
- neighbourTreeMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- neighbourTreeMenuItem_actionPerformed(e);
- }
- });
+ neighbourTreeMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ neighbourTreeMenuItem_actionPerformed(e);
+ }
+ });
this.getContentPane().setLayout(borderLayout1);
alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
statusBar.setBackground(Color.white);
.getString("label.out_to_textbox"));
clustalColour.setText(MessageManager.getString("label.clustalx"));
- clustalColour.addActionListener(new java.awt.event.ActionListener()
+ clustalColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
zappoColour.setText(MessageManager.getString("label.zappo"));
- zappoColour.addActionListener(new java.awt.event.ActionListener()
+ zappoColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
taylorColour.setText(MessageManager.getString("label.taylor"));
- taylorColour.addActionListener(new java.awt.event.ActionListener()
+ taylorColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
hydrophobicityColour.setText(MessageManager
.getString("label.hydrophobicity"));
- hydrophobicityColour
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hydrophobicityColour_actionPerformed(e);
- }
- });
+ hydrophobicityColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hydrophobicityColour_actionPerformed(e);
+ }
+ });
helixColour.setText(MessageManager.getString("label.helix_propensity"));
- helixColour.addActionListener(new java.awt.event.ActionListener()
+ helixColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
strandColour.setText(MessageManager
.getString("label.strand_propensity"));
- strandColour.addActionListener(new java.awt.event.ActionListener()
+ strandColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
turnColour.setText(MessageManager.getString("label.turn_propensity"));
- turnColour.addActionListener(new java.awt.event.ActionListener()
+ turnColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
buriedColour.setText(MessageManager.getString("label.buried_index"));
- buriedColour.addActionListener(new java.awt.event.ActionListener()
+ buriedColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
userDefinedColour.setText(MessageManager
.getString("action.user_defined"));
- userDefinedColour.addActionListener(new java.awt.event.ActionListener()
+ userDefinedColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
PIDColour
.setText(MessageManager.getString("label.percentage_identity"));
- PIDColour.addActionListener(new java.awt.event.ActionListener()
+ PIDColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
BLOSUM62Colour
.setText(MessageManager.getString("label.blosum62_score"));
- BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()
+ BLOSUM62Colour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
- nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+ nucleotideColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
purinePyrimidineColour.setText(MessageManager
.getString("label.purine_pyrimidine"));
- purinePyrimidineColour
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- purinePyrimidineColour_actionPerformed(e);
- }
- });
+ purinePyrimidineColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed(e);
+ }
+ });
RNAInteractionColour.setText("RNA Interaction type");
- RNAInteractionColour
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- RNAInteractionColour_actionPerformed(e);
- }
- });
+ RNAInteractionColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ RNAInteractionColour_actionPerformed(e);
+ }
+ });
/*
* covariationColour.setText("Covariation");
- * covariationColour.addActionListener(new java.awt.event.ActionListener() {
- * public void actionPerformed(ActionEvent e) {
- * covariationColour_actionPerformed(e); } });
+ * covariationColour.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) { covariationColour_actionPerformed(e); }
+ * });
*/
avDistanceTreeBlosumMenuItem.setText(MessageManager
.getString("label.average_distance_bloslum62"));
- avDistanceTreeBlosumMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- avTreeBlosumMenuItem_actionPerformed(e);
- }
- });
+ avDistanceTreeBlosumMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ avTreeBlosumMenuItem_actionPerformed(e);
+ }
+ });
njTreeBlosumMenuItem.setText(MessageManager
.getString("label.neighbour_blosum62"));
- njTreeBlosumMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- njTreeBlosumMenuItem_actionPerformed(e);
- }
- });
+ njTreeBlosumMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ njTreeBlosumMenuItem_actionPerformed(e);
+ }
+ });
annotationPanelMenuItem.setActionCommand("");
annotationPanelMenuItem.setText(MessageManager
.getString("label.show_annotations"));
});
colourTextMenuItem.setText(MessageManager
.getString("label.colour_text"));
- colourTextMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- colourTextMenuItem_actionPerformed(e);
- }
- });
+ colourTextMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ colourTextMenuItem_actionPerformed(e);
+ }
+ });
htmlMenuItem.setText(MessageManager.getString("label.html"));
- htmlMenuItem.addActionListener(new java.awt.event.ActionListener()
+ htmlMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
overviewMenuItem.setText(MessageManager
.getString("label.overview_window"));
- overviewMenuItem.addActionListener(new java.awt.event.ActionListener()
+ overviewMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
overviewMenuItem_actionPerformed(e);
}
});
+
undoMenuItem.setEnabled(false);
undoMenuItem.setText(MessageManager.getString("action.undo"));
- undoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_Z, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- undoMenuItem.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
undoMenuItem_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, undoMenuItem, al);
+
redoMenuItem.setEnabled(false);
redoMenuItem.setText(MessageManager.getString("action.redo"));
- redoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_Y, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- redoMenuItem.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
redoMenuItem_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
+
conservationMenuItem.setText(MessageManager
.getString("action.by_conservation"));
- conservationMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- conservationMenuItem_actionPerformed(e);
- }
- });
+ conservationMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ conservationMenuItem_actionPerformed(e);
+ }
+ });
noColourmenuItem.setText(MessageManager.getString("label.none"));
- noColourmenuItem.addActionListener(new java.awt.event.ActionListener()
+ noColourmenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
wrapMenuItem.setText(MessageManager.getString("label.wrap"));
- wrapMenuItem.addActionListener(new java.awt.event.ActionListener()
+ wrapMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
wrapMenuItem_actionPerformed(e);
}
});
+
printMenuItem.setText(MessageManager.getString("action.print") + "...");
- printMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_P, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- printMenuItem.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
printMenuItem_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, printMenuItem, al);
+
renderGapsMenuItem
.setText(MessageManager.getString("action.show_gaps"));
renderGapsMenuItem.setState(true);
- renderGapsMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- renderGapsMenuItem_actionPerformed(e);
- }
- });
+ renderGapsMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ renderGapsMenuItem_actionPerformed(e);
+ }
+ });
+
findMenuItem.setText(MessageManager.getString("action.find"));
- findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_F, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.find_tip")));
- findMenuItem.addActionListener(new java.awt.event.ActionListener()
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
findMenuItem_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, findMenuItem, al);
+
abovePIDThreshold.setText(MessageManager
.getString("label.above_identity_threshold"));
- abovePIDThreshold.addActionListener(new java.awt.event.ActionListener()
+ abovePIDThreshold.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
buttonGroup.add(showAutoLast);
showAutoFirst.setText(MessageManager.getString("label.show_first"));
showAutoFirst.setSelected(Cache.getDefault(
- Preferences.SHOW_AUTOCALC_ABOVE,
- false));
+ Preferences.SHOW_AUTOCALC_ABOVE, false));
showAutoFirst.addActionListener(new ActionListener()
{
@Override
});
nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
- nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+ nucleotideColour.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
deleteGroups
.setText(MessageManager.getString("action.undefine_groups"));
- deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- deleteGroups.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
deleteGroups_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
+
createGroup.setText(MessageManager.getString("action.create_groups"));
- createGroup.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_G, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- createGroup.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
createGroup_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, createGroup, al);
+
unGroup.setText(MessageManager.getString("action.remove_group"));
- unGroup.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_G, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false));
- unGroup.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
unGroup_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, unGroup, al);
+
copy.setText(MessageManager.getString("action.copy"));
- copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_C, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
- copy.addActionListener(new java.awt.event.ActionListener()
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
copy_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, copy, al);
+
cut.setText(MessageManager.getString("action.cut"));
- cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_X, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- cut.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
cut_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, cut, al);
+
delete.setText(MessageManager.getString("action.delete"));
- delete.addActionListener(new java.awt.event.ActionListener()
+ delete.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
delete_actionPerformed(e);
}
});
+
pasteMenu.setText(MessageManager.getString("action.paste"));
pasteNew.setText(MessageManager.getString("label.to_new_alignment"));
- pasteNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_V, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false));
- pasteNew.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
pasteNew_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, pasteNew, al);
+
pasteThis.setText(MessageManager.getString("label.to_this_alignment"));
- pasteThis.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_V, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- pasteThis.addActionListener(new java.awt.event.ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
pasteThis_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, pasteThis, al);
+
applyToAllGroups.setText(MessageManager
.getString("label.apply_colour_to_all_groups"));
- applyToAllGroups.addActionListener(new java.awt.event.ActionListener()
+ applyToAllGroups.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
applyToAllGroups_actionPerformed(e);
}
});
- createPNG.addActionListener(new java.awt.event.ActionListener()
+ createPNG.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
createPNG.setText("PNG");
font.setText(MessageManager.getString("action.font"));
- font.addActionListener(new java.awt.event.ActionListener()
+ font.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
seqLimits.setText(MessageManager
.getString("label.show_sequence_limits"));
seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
- seqLimits.addActionListener(new java.awt.event.ActionListener()
+ seqLimits.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
epsFile.setText("EPS");
- epsFile.addActionListener(new java.awt.event.ActionListener()
+ epsFile.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
createSVG.setText("SVG");
- createSVG.addActionListener(new java.awt.event.ActionListener()
+ createSVG.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
.getString("label.load_tree_for_sequence_set"));
LoadtreeMenuItem.setText(MessageManager
.getString("label.load_associated_tree"));
- LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
+ LoadtreeMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
scaleAbove.setVisible(false);
scaleAbove.setText(MessageManager.getString("action.scale_above"));
- scaleAbove.addActionListener(new java.awt.event.ActionListener()
+ scaleAbove.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
scaleLeft.setVisible(false);
scaleLeft.setSelected(true);
scaleLeft.setText(MessageManager.getString("action.scale_left"));
- scaleLeft.addActionListener(new java.awt.event.ActionListener()
+ scaleLeft.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
scaleRight.setVisible(false);
scaleRight.setSelected(true);
scaleRight.setText(MessageManager.getString("action.scale_right"));
- scaleRight.addActionListener(new java.awt.event.ActionListener()
+ scaleRight.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
centreColumnLabelsMenuItem.setState(false);
centreColumnLabelsMenuItem.setText(MessageManager
.getString("label.centre_column_labels"));
- centreColumnLabelsMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- centreColumnLabels_actionPerformed(e);
- }
- });
+ centreColumnLabelsMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ centreColumnLabels_actionPerformed(e);
+ }
+ });
followHighlightMenuItem.setVisible(true);
followHighlightMenuItem.setState(true);
followHighlightMenuItem.setText(MessageManager
modifyPID.setText(MessageManager
.getString("label.modify_identity_thereshold"));
- modifyPID.addActionListener(new java.awt.event.ActionListener()
+ modifyPID.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
});
modifyConservation.setText(MessageManager
.getString("label.modify_conservation_thereshold"));
- modifyConservation
- .addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- modifyConservation_actionPerformed(e);
- }
- });
+ modifyConservation.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ modifyConservation_actionPerformed(e);
+ }
+ });
sortByTreeMenu
.setText(MessageManager.getString("action.by_tree_order"));
sort.setText(MessageManager.getString("action.sort"));
MessageManager.getString("label.view_as_cdna"));
viewAsCdna.setToolTipText(JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.view_as_cdna_tip")));
- viewAsCdna.addActionListener(new ActionListener() {
+ viewAsCdna.addActionListener(new ActionListener()
+ {
@Override
public void actionPerformed(ActionEvent e)
{
hiddenMarkers_actionPerformed(e);
}
});
+
invertColSel.setText(MessageManager
.getString("action.invert_column_selection"));
- invertColSel.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_I, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.ALT_MASK, false));
- invertColSel.addActionListener(new ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.ALT_MASK, false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
invertColSel_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, invertColSel, al);
+
tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
{
@Override
tabbedPane_focusGained(e);
}
});
+
save.setText(MessageManager.getString("action.save"));
- save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- save.addActionListener(new ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
save_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, save, al);
+
reload.setEnabled(false);
reload.setText(MessageManager.getString("action.reload"));
reload.addActionListener(new ActionListener()
reload_actionPerformed(e);
}
});
+
newView.setText(MessageManager.getString("action.new_view"));
- newView.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_T, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- newView.addActionListener(new ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
newView_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, newView, al);
+
tabbedPane.setToolTipText("<html><i>"
+ MessageManager.getString("label.rename_tab_eXpand_reGroup")
+ "</i></html>");
idRightAlign_actionPerformed(e);
}
});
+
gatherViews.setEnabled(false);
gatherViews.setText(MessageManager.getString("action.gather_views"));
- gatherViews.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_G, 0, false));
- gatherViews.addActionListener(new ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
gatherViews_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, gatherViews, al);
+
expandViews.setEnabled(false);
expandViews.setText(MessageManager.getString("action.expand_views"));
- expandViews.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_X, 0, false));
- expandViews.addActionListener(new ActionListener()
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
+ al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
expandViews_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, expandViews, al);
+
pageSetup
.setText(MessageManager.getString("action.page_setup") + "...");
pageSetup.addActionListener(new ActionListener()
// selectMenu.add(listenToViewSelections);
}
+ /**
+ * Adds the given action listener and key accelerator to the given menu item.
+ * Also saves in a lookup table to support lookup of action by key stroke.
+ *
+ * @param keyStroke
+ * @param menuItem
+ * @param actionListener
+ */
+ protected void addMenuActionAndAccelerator(KeyStroke keyStroke,
+ JMenuItem menuItem, ActionListener actionListener)
+ {
+ menuItem.setAccelerator(keyStroke);
+ accelerators.put(keyStroke, actionListener);
+ menuItem.addActionListener(actionListener);
+ }
+
protected void viewAsCdna_actionPerformed()
{
}
this.annotationSortOrder = annotationSortOrder;
}
- public Map<KeyStroke, JMenuItem> getAccelerators()
+ public Map<KeyStroke, ActionListener> getAccelerators()
{
return this.accelerators;
}