From 5370e0f6d7979644e2f9d8eddbbe39b0aac57d81 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 23 Sep 2005 16:17:12 +0000 Subject: [PATCH] Right click copy/paste popup --- src/jalview/gui/CutAndPasteTransfer.java | 29 ++++++++++++++++++++++++++- src/jalview/jbgui/GCutAndPasteTransfer.java | 7 ++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 219ad4b..f2920e5 100755 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -103,7 +103,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer try { - textarea.setText((String) contents.getTransferData( + textarea.append((String) contents.getTransferData( DataFlavor.stringFlavor)); } catch (Exception ex) @@ -175,4 +175,31 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer { } } + + public void textarea_mousePressed(MouseEvent e) + { + if(SwingUtilities.isRightMouseButton(e)) + { + JPopupMenu popup = new JPopupMenu("Edit"); + JMenuItem item = new JMenuItem("Copy"); + item.addActionListener(new ActionListener() + {public void actionPerformed(ActionEvent e) + { + copyItem_actionPerformed(e); + } + }); + popup.add(item); + item = new JMenuItem("Paste"); + item.addActionListener(new ActionListener() + {public void actionPerformed(ActionEvent e) + { + pasteMenu_actionPerformed(e); + } + }); + popup.add(item); + popup.show(this, e.getX(), e.getY()+30); + + } + } + } diff --git a/src/jalview/jbgui/GCutAndPasteTransfer.java b/src/jalview/jbgui/GCutAndPasteTransfer.java index 0c42724..384f09e 100755 --- a/src/jalview/jbgui/GCutAndPasteTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteTransfer.java @@ -145,12 +145,9 @@ public class GCutAndPasteTransfer extends JInternalFrame * * @param e DOCUMENT ME! */ - void textarea_mousePressed(MouseEvent e) + public void textarea_mousePressed(MouseEvent e) { - if (textarea.getText().equals("Paste your alignment file here")) - { - textarea.setText(""); - } + } /** -- 1.7.10.2