import javax.swing.JRadioButtonMenuItem;
import javax.swing.JTabbedPane;
import javax.swing.KeyStroke;
-import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
-
JMenuItem copy = new JMenuItem();
JMenuItem cut = new JMenuItem();
@Override
public void mousePressed(MouseEvent evt)
{
- if (evt.isControlDown()
- || SwingUtilities.isRightMouseButton(evt))
+ if (evt.isPopupTrigger()) // Mac
{
- radioItem.removeActionListener(radioItem.getActionListeners()[0]);
-
- int option = JOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop,
- MessageManager
- .getString("label.remove_from_default_list"),
- MessageManager
- .getString("label.remove_user_defined_colour"),
- JOptionPane.YES_NO_OPTION);
- if (option == JOptionPane.YES_OPTION)
- {
- jalview.gui.UserDefinedColours
- .removeColourFromDefaults(radioItem.getText());
- colourMenu.remove(radioItem);
- }
- else
+ offerRemoval(radioItem);
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Windows
+ {
+ offerRemoval(radioItem);
+ }
+ }
+
+ /**
+ * @param radioItem
+ */
+ void offerRemoval(final JRadioButtonMenuItem radioItem)
+ {
+ radioItem.removeActionListener(radioItem.getActionListeners()[0]);
+
+ int option = JOptionPane.showInternalConfirmDialog(
+ jalview.gui.Desktop.desktop, MessageManager
+ .getString("label.remove_from_default_list"),
+ MessageManager
+ .getString("label.remove_user_defined_colour"),
+ JOptionPane.YES_NO_OPTION);
+ if (option == JOptionPane.YES_OPTION)
+ {
+ jalview.gui.UserDefinedColours
+ .removeColourFromDefaults(radioItem.getText());
+ colourMenu.remove(radioItem);
+ }
+ else
+ {
+ radioItem.addActionListener(new ActionListener()
{
- radioItem.addActionListener(new ActionListener()
+ @Override
+ public void actionPerformed(ActionEvent evt)
{
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
- }
+ userDefinedColour_actionPerformed(evt);
+ }
+ });
}
}
});
});
JMenuItem modifyPID = new JMenuItem(
- MessageManager.getString("label.modify_identity_thereshold"));
+ MessageManager.getString("label.modify_identity_threshold"));
modifyPID.addActionListener(new ActionListener()
{
@Override
}
});
modifyConservation.setText(MessageManager
- .getString("label.modify_conservation_thereshold"));
+ .getString("label.modify_conservation_threshold"));
modifyConservation.addActionListener(new ActionListener()
{
@Override
showProducts.setText(MessageManager.getString("label.get_cross_refs"));
runGroovy.setText(MessageManager.getString("label.run_groovy"));
- runGroovy.setToolTipText(MessageManager.getString("label.run_groovy_tip"));
+ runGroovy.setToolTipText(MessageManager
+ .getString("label.run_groovy_tip"));
runGroovy.addActionListener(new ActionListener()
{
@Override
@Override
public void mousePressed(MouseEvent e)
{
- tabbedPane_mousePressed(e);
+ if (e.isPopupTrigger()) // Mac
+ {
+ tabbedPane_mousePressed(e);
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e)
+ {
+ if (e.isPopupTrigger()) // Windows
+ {
+ tabbedPane_mousePressed(e);
+ }
}
});
tabbedPane.addFocusListener(new FocusAdapter()
{
}
+
/**
* 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.
}
- protected void showSeqFeaturesHeight_actionPerformed(
- ActionEvent actionEvent)
- {
- // TODO Auto-generated method stub
-
- }
-
protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub