From b14411143cbfb4d311f68b3d3b73a645bf8200e8 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 14 Jun 2005 15:06:03 +0000 Subject: [PATCH] ToolTip updated --- src/jalview/gui/AnnotationPanel.java | 50 ++++++++++++++++------------------ src/jalview/gui/RotatableCanvas.java | 3 +- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 449c449..50c9fef 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -52,13 +52,14 @@ public class AnnotationPanel public AnnotationPanel(AlignmentPanel ap) { + ToolTipManager.sharedInstance().registerComponent(this); + ToolTipManager.sharedInstance().setInitialDelay(0); + ToolTipManager.sharedInstance().setDismissDelay(10000); this.ap = ap; av = ap.av; this.setLayout(null); addMouseListener(this); addMouseMotionListener(this); - adjustPanelHeight(); - ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this); } @@ -259,6 +260,26 @@ public class AnnotationPanel public void mousePressed(MouseEvent evt) { + int height = 0; + activeRow = -1; + AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + + for (int i = 0; i < aa.length; i++) + { + height += aa[i].height; + + if (evt.getY() < height) + { + if (aa[i].editable) + activeRow = i; + else + activeRes = null; + + break; + } + } + + if (SwingUtilities.isRightMouseButton(evt)) { if (activeRes == null) @@ -266,6 +287,7 @@ public class AnnotationPanel return; } + JPopupMenu pop = new JPopupMenu("Structure type"); JMenuItem item = new JMenuItem(HELIX); item.addActionListener(this); @@ -287,34 +309,12 @@ public class AnnotationPanel return; } - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); if (aa == null) { return; } - int height = 0; - activeRow = -1; - - for (int i = 0; i < aa.length; i++) - { - height += aa[i].height; - - if (evt.getY() < height) - { - if (!aa[i].editable) - { - activeRes = null; - - continue; - } - - activeRow = i; - - break; - } - } int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); @@ -374,8 +374,6 @@ public class AnnotationPanel public void mouseMoved(MouseEvent evt) { - ToolTipManager.sharedInstance().registerComponent(this); - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); if (aa == null) diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 6ae66a2..c3384f9 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -75,9 +75,10 @@ public class RotatableCanvas this.npoint = npoint; this.av = av; ToolTipManager.sharedInstance().registerComponent(this); + ToolTipManager.sharedInstance().setInitialDelay(0); + ToolTipManager.sharedInstance().setDismissDelay(10000); PaintRefresher.Register(this, av.alignment); - // prefsize = getPreferredSize(); orig = new float[npoint][3]; -- 1.7.10.2