List of usage examples for javax.swing JEditorPane setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:util.ui.UiUtilities.java
/** * Creates a Html EditorPane that holds a HTML-Help Text. * * Add a Listener if you want to have clickable Links * * @param html//from www . j a v a2 s . co m * HTML-Text to display * @param listener * Link-Listener for this HelpText * @param background The color for the background. * @return EditorPane that holds a Help Text * @since 2.7.2 */ public static JEditorPane createHtmlHelpTextArea(String html, HyperlinkListener listener, Color background) { // Quick "hack". Remove HTML-Code and replace it with Code that includes the // correct Font if (html.indexOf("<html>") >= 0) { html = StringUtils.substringBetween(html, "<html>", "</html>"); } JLabel label = new JLabel(); Font font = label.getFont(); html = "<html><div style=\"color:" + UiUtilities.getHTMLColorCode(label.getForeground()) + ";font-family:" + font.getName() + "; font-size:" + font.getSize() + ";background-color:rgb(" + background.getRed() + "," + background.getGreen() + "," + background.getBlue() + ");\">" + html + "</div></html>"; final JEditorPane pane = new JEditorPane("text/html", html); pane.setBorder(BorderFactory.createEmptyBorder()); pane.setEditable(false); pane.setFont(font); pane.setOpaque(false); pane.setFocusable(false); if (listener != null) { pane.addHyperlinkListener(listener); } return pane; }