Merge branch 'feature/JAL-2664' into feature/JAL-2527
[jalview.git] / src / jalview / appletgui / Tooltip.java
index 10cb6b8..d629cf6 100755 (executable)
@@ -1,31 +1,42 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
  *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.appletgui;
 
-import java.applet.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-public class Tooltip extends Canvas implements MouseListener,
-        MouseMotionListener
+import java.applet.Applet;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.LayoutManager;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.StringTokenizer;
+
+public class Tooltip extends Canvas
+        implements MouseListener, MouseMotionListener
 {
   private String[] tip;
 
@@ -80,8 +91,8 @@ public class Tooltip extends Canvas implements MouseListener,
       {
         if (lindex > 0)
         {
-          g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight
-                  - 3);
+          g.drawString(tip[i].substring(0, lindex), 3,
+                  (i + 1) * fontHeight - 3);
           x += fm.stringWidth(tip[i].substring(0, lindex) + 3);
         }
         g.drawImage(linkImage, x, i * fontHeight + 1, this);
@@ -144,11 +155,11 @@ public class Tooltip extends Canvas implements MouseListener,
       return;
     }
     setLocation(
-            (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x)
-                    + evt.getX(),
+            (owner.getLocationOnScreen().x
+                    - mainContainer.getLocationOnScreen().x) + evt.getX(),
             (owner.getLocationOnScreen().y
-                    - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET)
-                    + evt.getY());
+                    - mainContainer.getLocationOnScreen().y
+                    + VERTICAL_OFFSET) + evt.getY());
 
     // correction, whole tool tip must be visible
     if (mainContainer.getSize().width < (getLocation().x + getSize().width))