- colourMenu.add(noColourmenuItem);
- colours.add(noColourmenuItem);
-
- /*
- * scan registered colour schemes (built-in or user-defined
- * and add them to the menu (in the order they were added)
- */
- Iterable<ColourSchemeI> colourSchemes = ColourSchemes.getInstance()
- .getColourSchemes();
- for (ColourSchemeI scheme : colourSchemes)
- {
- /*
- * button text is i18n'd but the name is the canonical name of
- * the colour scheme (inspected in changeColour_actionPerformed)
- */
- final String name = scheme.getSchemeName();
- String label = MessageManager.getString("label.colourScheme_"
- + name.toLowerCase().replace(" ", "_"));
- final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(label);
- radioItem.setName(name);
- if (scheme instanceof UserColourScheme)
- {
- /*
- * user-defined colour scheme loaded on startup or during the
- * Jalview session; right-click on this offers the option to
- * remove it as a colour choice
- */
- radioItem.setText(((UserColourScheme) scheme).getName());
- radioItem.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mousePressed(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Mac
- {
- offerRemoval();
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Windows
- {
- offerRemoval();
- }
- }