Here you can find the source of toHTML(String msg)
Turns the specified message into HTML code, for use with JLabels, tooltips and such, to achieve multiline text.
public static String toHTML(String msg)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . java2 s . c o m*/ * <p> * Turns the specified message into HTML code, for use with JLabels, tooltips and such, * to achieve multiline text. * </p> * * <pre> * {@literal * Replaces '\n' with '<br/>', '>' and '<' with their HTML equivalents, and wraps * the message in <html></html> tags. * } * </pre> */ public static String toHTML(String msg) { msg = msg.replaceAll("<", "<"); msg = msg.replaceAll(">", ">"); msg = msg.replaceAll("\n", "<br/>"); return "<html>" + msg + "</html>"; } }