From 10b678ebd64a6ae54d45d1c92acf8de2fb3133ff Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 28 Apr 2006 12:34:28 +0000 Subject: [PATCH] Edit menu added --- src/jalview/gui/PopupMenu.java | 91 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 4f2326a..968262b 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -68,8 +68,13 @@ public class PopupMenu extends JPopupMenu JCheckBoxMenuItem showBoxes = new JCheckBoxMenuItem(); JCheckBoxMenuItem showText = new JCheckBoxMenuItem(); JCheckBoxMenuItem showColourText = new JCheckBoxMenuItem(); + JMenu jMenu1 = new JMenu(); + JMenuItem cut = new JMenuItem(); + JMenuItem copy = new JMenuItem(); + JMenuItem upperCase = new JMenuItem(); + JMenuItem lowerCase = new JMenuItem(); - /** + /** * Creates a new PopupMenu object. * * @param ap DOCUMENT ME! @@ -227,6 +232,8 @@ public class PopupMenu extends JPopupMenu showColourText.setSelected(sg.getColourText()); showBoxes.setSelected(sg.getDisplayBoxes()); } + else + groupMenu.setVisible(false); if (!ap.av.alignment.getGroups().contains(sg)) { @@ -284,7 +291,7 @@ public class PopupMenu extends JPopupMenu private void jbInit() throws Exception { groupMenu.setText("Group"); - groupMenu.setText("Define"); + groupMenu.setText("Group"); groupName.setText("Name"); groupName.addActionListener(new java.awt.event.ActionListener() { @@ -355,9 +362,43 @@ public class PopupMenu extends JPopupMenu showColourText_actionPerformed(e); } }); - add(groupMenu); + jMenu1.setText("Edit"); + cut.setText("Cut"); + cut.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cut_actionPerformed(e); + } + }); + upperCase.setText("To Upper Case"); + upperCase.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + upperCase_actionPerformed(e); + } + }); + copy.setText("Copy"); + copy.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + copy_actionPerformed(e); + } + }); + lowerCase.setText("To Lower Case"); + lowerCase.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + lowerCase_actionPerformed(e); + } + }); + add(groupMenu); add(sequenceMenu); - groupMenu.add(groupName); + this.add(jMenu1); + groupMenu.add(groupName); groupMenu.addSeparator(); groupMenu.add(unGroupMenuItem); groupMenu.add(colourMenu); @@ -406,7 +447,11 @@ public class PopupMenu extends JPopupMenu colourMenu.addSeparator(); colourMenu.add(abovePIDColour); colourMenu.add(conservationMenuItem); - noColourmenuItem.setText("None"); + jMenu1.add(copy); + jMenu1.add(cut); + jMenu1.add(upperCase); + jMenu1.add(lowerCase); + noColourmenuItem.setText("None"); noColourmenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -988,4 +1033,40 @@ public class PopupMenu extends JPopupMenu refresh(); } + public void copy_actionPerformed(ActionEvent e) + { + ap.alignFrame.copy_actionPerformed(null); + } + + public void cut_actionPerformed(ActionEvent e) + { + ap.alignFrame.cut_actionPerformed(null); + } + + public void upperCase_actionPerformed(ActionEvent e) + { + SequenceGroup sg = ap.av.getSelectionGroup(); + if(sg==null) + return; + + for(int g=0; g