JAL-3054 table tooltip follow mouse in a sensible manner bug/JAL-3049colourCellTooltip
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 3 Jul 2018 12:42:15 +0000 (13:42 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 3 Jul 2018 12:42:15 +0000 (13:42 +0100)
src/jalview/gui/FeatureSettings.java

index a1d9a04..7fb3af9 100644 (file)
@@ -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));