From 5f0327b9a1f7adedb23e9188aef61e98dd14a1c2 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 15 Dec 2004 17:17:51 +0000 Subject: [PATCH] Right mouse brings up Popupmenu --- src/jalview/gui/IdPanel.java | 60 +++++++++++++----------------------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 644d2ce..ff175aa 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -33,7 +33,8 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene public void mouseMoved(MouseEvent e) {} public void selectSeqs(int start, int end) { - if (end < start) { + if (end < start) + { int tmp = start; start = end; end = tmp; @@ -74,9 +75,6 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene int y = e.getY(); int seq = av.getIndex(y); - - - if (seq < lastid) selectSeqs(lastid - 1, seq); else if (seq > lastid) @@ -112,50 +110,28 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene int y = e.getY(); int seq = av.getIndex(y); + selectedSequenceGroup = av.getRubberbandGroup(); + if (selectedSequenceGroup == null) + { + selectedSequenceGroup = new SequenceGroup(); + av.setRubberbandGroup(selectedSequenceGroup); + } - if( javax.swing.SwingUtilities.isRightMouseButton(e)) - { - jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( av , alignPanel.seqPanel); - pop.show(this, e.getX(), y); - - - /* String id = av.getAlignment().getSequenceAt(seq).getName(); - String s = (String)JOptionPane.showInternalInputDialog( - this, - "Edit sequence name", - "Edit sequence name", - JOptionPane.PLAIN_MESSAGE, - null, - null, - id); - - if(s!=null) - { - av.getAlignment().getSequenceAt(seq).setName(s); - alignPanel.RefreshPanels(); - }*/ - - } - else - { + selectedSequenceGroup.setStartRes(0); + selectedSequenceGroup.setEndRes(av.getAlignment().getWidth() - 1); - selectedSequenceGroup = av.getRubberbandGroup(); - if(selectedSequenceGroup==null) - { - selectedSequenceGroup = new SequenceGroup(); - av.setRubberbandGroup(selectedSequenceGroup); - } + if (seq != -1) + selectSeqs(seq, seq); - selectedSequenceGroup.setStartRes(0); - selectedSequenceGroup.setEndRes( av.getAlignment().getWidth()-1 ); + lastid = seq; - // selectedSequenceGroup = av.alignment.findGroup(seq); + if( javax.swing.SwingUtilities.isRightMouseButton(e)) + { + jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel, av.getAlignment().getSequenceAt(seq) ); + pop.show(this, e.getX(), y); + } - if (seq != -1) - selectSeqs(seq,seq); - lastid = seq; - } return; } -- 1.7.10.2