From 8334a9d216c71bd0960ea01e2991c26382a139b7 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 3 Jul 2018 13:42:15 +0100 Subject: [PATCH] JAL-3054 table tooltip follow mouse in a sensible manner --- src/jalview/gui/FeatureSettings.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index a1d9a04..7fb3af9 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -233,6 +233,21 @@ public class FeatureSettings extends JPanel } return tip; } + + /** + * Position the tooltip at the bottom edge of, and half way across, the + * current cell + */ + @Override + public Point getToolTipLocation(MouseEvent e) + { + Point point = e.getPoint(); + int column = table.columnAtPoint(point); + int row = table.rowAtPoint(point); + Rectangle r = getCellRect(row, column, false); + Point loc = new Point(r.x + r.width / 2, r.y + r.height); + return loc; + } }; table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12)); table.setFont(new Font("Verdana", Font.PLAIN, 12)); -- 1.7.10.2