X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FTooltip.java;h=d629cf665b8ae2a8f31ef93694988b2a43bb7d11;hb=04c8f7bff663aa469127e9eed4164e02933782f1;hp=10cb6b845ce6e46528236363f9125942ecfa0499;hpb=a8f483d04205bb8273ee311c12968b7e86d205fa;p=jalview.git diff --git a/src/jalview/appletgui/Tooltip.java b/src/jalview/appletgui/Tooltip.java index 10cb6b8..d629cf6 100755 --- a/src/jalview/appletgui/Tooltip.java +++ b/src/jalview/appletgui/Tooltip.java @@ -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 . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . * 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))