colourMenu.add(buriedColour);\r
colourMenu.add(nucleotideMenuItem);\r
colourMenu.add(userDefinedColour);\r
+\r
+ if(jalview.gui.UserDefinedColours.getUserColourSchemes()!=null)\r
+ {\r
+ java.util.Enumeration userColours = jalview.gui.UserDefinedColours.\r
+ getUserColourSchemes().keys();\r
+\r
+ while (userColours.hasMoreElements())\r
+ {\r
+ JMenuItem item = new JMenuItem(userColours.\r
+ nextElement().toString());\r
+ item.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ userDefinedColour_actionPerformed(evt);\r
+ }\r
+ });\r
+ colourMenu.add(item);\r
+ }\r
+ }\r
+\r
+\r
colourMenu.addSeparator();\r
colourMenu.add(abovePIDColour);\r
colourMenu.add(conservationMenuItem);\r
abovePIDColour_actionPerformed(e);\r
}\r
});\r
- userDefinedColour.setText("User Defined");\r
+ userDefinedColour.setText("User Defined...");\r
userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
{\r
public void actionPerformed(ActionEvent e)\r
*/\r
protected void userDefinedColour_actionPerformed(ActionEvent e)\r
{\r
- new UserDefinedColours(ap, getGroup());\r
- }\r
-\r
+ SequenceGroup sg = getGroup();\r
+\r
+ if (e.getActionCommand().equals("User Defined..."))\r
+ new UserDefinedColours(ap, sg);\r
+ else\r
+ {\r
+ UserColourScheme udc = (UserColourScheme) UserDefinedColours.\r
+ getUserColourSchemes().get(e.getActionCommand());\r
+\r
+ sg.cs = udc;\r
+ }\r
+ }\r
/**\r
* DOCUMENT ME!\r
*\r
import javax.swing.*;\r
import javax.swing.event.*;\r
\r
-import jalview.gui.*;\r
import jalview.schemes.*;\r
\r
public class GAlignFrame\r
JMenu jMenu2 = new JMenu();\r
JMenuItem padGapsMenuitem = new JMenuItem();\r
JMenuItem ClustalRealign = new JMenuItem();\r
+ protected ButtonGroup colours = new ButtonGroup();\r
\r
public GAlignFrame()\r
{\r
- ButtonGroup colours = new ButtonGroup();\r
- colours.add(noColourmenuItem);\r
- colours.add(clustalColour);\r
- colours.add(zappoColour);\r
- colours.add(taylorColour);\r
- colours.add(hydrophobicityColour);\r
- colours.add(helixColour);\r
- colours.add(strandColour);\r
- colours.add(turnColour);\r
- colours.add(buriedColour);\r
- colours.add(userDefinedColour);\r
- colours.add(PIDColour);\r
- colours.add(BLOSUM62Colour);\r
- colours.add(nucleotideColour);\r
-\r
- setColourSelected(jalview.bin.Cache.getDefault("DEFAULT_COLOUR", "None"));\r
\r
\r
try\r
jbInit();\r
setJMenuBar(alignFrameMenuBar);\r
\r
- JMenuItem item;\r
-\r
// dynamically fill save as menu with available formats\r
for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++)\r
{\r
- item = new JMenuItem( (String) jalview.io.FormatAdapter.formats.\r
+ JMenuItem item = new JMenuItem( (String) jalview.io.FormatAdapter.formats.\r
elementAt(\r
i));\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
}\r
\r
+\r
+ if(jalview.gui.UserDefinedColours.getUserColourSchemes()!=null)\r
+ {\r
+ java.util.Enumeration userColours = jalview.gui.UserDefinedColours.\r
+ getUserColourSchemes().keys();\r
+\r
+ while (userColours.hasMoreElements())\r
+ {\r
+ JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(userColours.\r
+ nextElement().toString());\r
+ radioItem.setName("USER_DEFINED");\r
+ radioItem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ userDefinedColour_actionPerformed(evt);\r
+ }\r
+ });\r
+ colourMenu.insert(radioItem, 15);\r
+ colours.add(radioItem);\r
+ }\r
+ }\r
+ colours.add(noColourmenuItem);\r
+ colours.add(clustalColour);\r
+ colours.add(zappoColour);\r
+ colours.add(taylorColour);\r
+ colours.add(hydrophobicityColour);\r
+ colours.add(helixColour);\r
+ colours.add(strandColour);\r
+ colours.add(turnColour);\r
+ colours.add(buriedColour);\r
+ colours.add(userDefinedColour);\r
+ colours.add(PIDColour);\r
+ colours.add(BLOSUM62Colour);\r
+ colours.add(nucleotideColour);\r
+\r
+ setColourSelected(jalview.bin.Cache.getDefault("DEFAULT_COLOUR", "None"));\r
+\r
+\r
}\r
\r
public void setColourSelected(String defaultColour)\r