Class GuiUtils.Text

java.lang.Object
sc.fiji.snt.gui.GuiUtils.Text
Enclosing class:
GuiUtils

public static class GuiUtils.Text extends Object
Utility methods for wrapping, truncating, escaping, and lightly formatting plain/HTML text.
  • Constructor Details

    • Text

      public Text()
  • Method Details

    • toTitleCase

      public static String toTitleCase(String s)
      Converts an action-name string to Title Case.
    • renderedWidth

      public static int renderedWidth(String text)
    • escapeHtml

      public static String escapeHtml(String text)
      Escapes the handful of characters that are meaningful to an HTML parser. Use before placing plain text inside HTML markup, so that a stray '<'/'&' in it is displayed literally instead of being misread as markup (an unescaped '<' in particular would otherwise be parsed as the start of a tag and swallow the rest of the text)
      Parameters:
      text - the plain text to escape
    • markdownToHtml

      public static String markdownToHtml(String text)
      Converts a minimal, deliberately limited subset of Markdown (bold: **text** or __text__; italic: *text* or _text_) into HTML. The input is first run through escapeHtml(String), so a literal '<', '>', or '&' in text is preserved as-is rather than read as markup, and only the recognized emphasis markers are turned into <b>/<i> tags; everything else is left as plain (now HTML-safe) text.
      Parameters:
      text - the plain text, optionally containing basic Markdown emphasis markers
      Returns:
      HTML-escaped text with recognized Markdown emphasis converted to <b>/<i> tags
    • truncate

      public static String truncate(String label, int maxLength)
    • containsNumber

      public static boolean containsNumber(String text)
    • containsSeparator

      public static boolean containsSeparator(String text)
    • getClipboard

      public static String getClipboard()