From: gmungoc Date: Tue, 3 Jul 2018 12:42:15 +0000 (+0100) Subject: JAL-3054 table tooltip follow mouse in a sensible manner X-Git-Tag: Release_2_11_0~17^2~74^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-3049colourCellTooltip;p=jalview.git JAL-3054 table tooltip follow mouse in a sensible manner --- 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));