From 0fd0aa9f6a7e7e4fff5d9bce03ff5734fb803e09 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 1 Sep 2016 14:46:53 +0100 Subject: [PATCH] JAL-2077 check isPopupTrigger in mouseReleased not mouseClicked (Windows) --- src/jalview/gui/TreeCanvas.java | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 279d9ad..6bfea9e 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -755,6 +755,14 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, @Override public void mouseReleased(MouseEvent e) { + /* + * isPopupTrigger is set on mouseReleased on Windows + */ + if (e.isPopupTrigger()) + { + chooseSubtreeColour(); + e.consume(); // prevent mouseClicked happening + } } /** @@ -792,15 +800,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, return; } - /* - * isPopupTrigger is set on mouseReleased / - * mouseClicked on Windows - */ - if (evt.isPopupTrigger()) - { - chooseSubtreeColour(); - } - else if (evt.getClickCount() > 1) + if (evt.getClickCount() > 1) { tree.swapNodes(highlightNode); tree.reCount(tree.getTopNode()); @@ -887,7 +887,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, /* * isPopupTrigger is set for mousePressed (Mac) - * or mouseReleased / mouseClicked (Windows) + * or mouseReleased (Windows) */ if (e.isPopupTrigger()) { @@ -967,9 +967,9 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, { Color col = new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)); - setColor((SequenceNode) tree.getGroups().elementAt(i), col.brighter()); + setColor(tree.getGroups().elementAt(i), col.brighter()); - Vector l = tree.findLeaves((SequenceNode) tree + Vector l = tree.findLeaves(tree .getGroups().elementAt(i)); Vector sequences = new Vector(); -- 1.7.10.2