Use this with required CSS,
yourLabel.setText(htmlIfy("<p style='color:#1C66AE;'>Your text here</p>"));
where the htmlIfy
function is
private static final String HTML = "<html>";
private static final String HTML_END = "</html>";
public static String htmlIfy(String s) {
return HTML.concat(s).concat(HTML_END);
}
to add text like link use
yourLabel.setText(HTMLTagUtil.htmlIfy(HTMLTagUtil
.linkIfy("Your Text Here")));//Forgot Password?
yourLabel.setCursor(new java.awt.Cursor(
java.awt.Cursor.HAND_CURSOR));
where the linkIfy
function is
private static final String A_HREF = "<a href=\"";
private static final String HREF_CLOSED = "\">";
private static final String HREF_END = "</a>";
public static String linkIfy(String s) {
return A_HREF.concat(s).concat(HREF_CLOSED).concat(s).concat(HREF_END);
}