X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJvSwingUtils.java;h=fb487d81ac82e339944fe8f9ce2f071fcf7a4c98;hb=521951df7d677995b8e142fd0a3c3061df5d2781;hp=46586686fc773e36bddf1643ac11638e86957e8d;hpb=0b1037e0bf412da13da24833ff9cdbf24c9aea60;p=jalview.git
diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java
index 4658668..fb487d8 100644
--- a/src/jalview/gui/JvSwingUtils.java
+++ b/src/jalview/gui/JvSwingUtils.java
@@ -56,12 +56,15 @@ import javax.swing.border.TitledBorder;
*/
public final class JvSwingUtils
{
+ static final String HTML_PREFIX = "
";
+
/**
* wrap a bare html safe string to around 60 characters per line using a CSS
* style class specifying word-wrap and break-word
*
* @param enclose
- * if true, add <html> wrapper tags
+ * if true, add <html> wrapper tags (currently false for only
+ * two references -- both in Jws2Discoverer --
* @param ttext
*
* @return
@@ -70,10 +73,21 @@ public final class JvSwingUtils
{
Objects.requireNonNull(ttext,
"Tootip text to format must not be null!");
- ttext = ttext.trim();
+ ttext = ttext.trim().replaceAll("
", "
");
boolean maxLengthExceeded = false;
-
- if (ttext.contains("
"))
+ boolean isHTML = ttext.startsWith("");
+ if (isHTML)
+ {
+ ttext = ttext.substring(6);
+ }
+ if (ttext.endsWith(""))
+ {
+ isHTML = true;
+ ttext = ttext.substring(0, ttext.length() - 7);
+ }
+ boolean hasBR = ttext.contains("
");
+ enclose |= isHTML || hasBR;
+ if (hasBR)
{
String[] htmllines = ttext.split("
");
for (String line : htmllines)
@@ -94,10 +108,8 @@ public final class JvSwingUtils
{
return enclose ? "" + ttext + "" : ttext;
}
-
- return (enclose ? "" : "")
- + "
"
- + ttext + "
" + ((enclose ? "" : ""));
+ // BH 2018,2019
+ return (enclose ? HTML_PREFIX + ttext + "
" : ttext);
}
@@ -341,6 +353,7 @@ public final class JvSwingUtils
combo.setToolTipText(tooltips.get(j));
}
}
+
@Override
public void mouseExited(MouseEvent e)
{