From 6f72987ac17c0846a12b635c29fc1788b3c13b8c Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 8 Nov 2006 17:35:08 +0000 Subject: [PATCH] Tooltip on mouseover --- src/jalview/gui/TreeCanvas.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index a9c3ae0..3a7f05e 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -83,6 +83,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, addMouseListener(this); addMouseMotionListener(this); PaintRefresher.Register(this, ap.av.getSequenceSetId()); + ToolTipManager.sharedInstance().registerComponent(this); } @@ -663,6 +664,14 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, { if(highlightNode!=null) { + if (SwingUtilities.isRightMouseButton(evt)) + { + Color col = JColorChooser.showDialog(this, "Select Background Colour", + highlightNode.color); + + setColor(highlightNode, col); + } + else if(evt.getClickCount()>1) { tree.swapNodes(highlightNode); @@ -698,13 +707,19 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (ob instanceof SequenceNode) { highlightNode = (SequenceNode) ob; + this.setToolTipText( + "Left click to select leaves" + + "
Double-click to invert leaves" + + "
Right click to change colour"); repaint(); + } else { if (highlightNode != null) { highlightNode = null; + setToolTipText(""); repaint(); } } -- 1.7.10.2