JAL-3253-applet JAL-3423 Windows TestNG
[jalview.git] / src / jalview / gui / JvSwingUtils.java
index b25b2c8..7dd8e6c 100644 (file)
@@ -58,6 +58,7 @@ public final class JvSwingUtils
 {
   public static final String HTML_PREFIX = "<html><div style=\"width:350px;white-space:pre-wrap;padding:2px;overflow-wrap:break-word;\">";
 
+
   /**
    * wrap a bare html safe string to around 60 characters per line using a CSS
    * style class specifying word-wrap and break-word
@@ -75,8 +76,19 @@ public final class JvSwingUtils
             "Tootip text to format must not be null!");
     ttext = ttext.trim();
     boolean maxLengthExceeded = false;
-
-    if (ttext.contains("<br>"))
+    boolean isHTML = ttext.startsWith("<html>");
+    if (isHTML)
+    {
+      ttext = ttext.substring(6);
+    }
+    if (ttext.endsWith("</html>"))
+    {
+      isHTML = true;
+      ttext = ttext.substring(0, ttext.length() - 7);
+    }
+    boolean hasBR = ttext.contains("<br>");
+    enclose |= isHTML || hasBR;
+    if (hasBR)
     {
       String[] htmllines = ttext.split("<br>");
       for (String line : htmllines)