List of usage examples for javax.swing JEditorPane setCursor
public void setCursor(Cursor cursor)
From source file:util.ui.UiUtilities.java
/** * Creates a Html EditorPane that holds a HTML-Help Text * * Links will be displayed and are clickable * * @param html/*from www. j ava 2 s .c o m*/ * HTML-Text to display * @param background The color for the background. * @return EditorPane that holds a Help Text * @since 2.7.2 */ public static JEditorPane createHtmlHelpTextArea(String html, Color background) { return createHtmlHelpTextArea(html, new HyperlinkListener() { private String mTooltip; public void hyperlinkUpdate(HyperlinkEvent evt) { JEditorPane pane = (JEditorPane) evt.getSource(); if (evt.getEventType() == HyperlinkEvent.EventType.ENTERED) { mTooltip = pane.getToolTipText(); pane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); if (evt.getURL() != null) { pane.setToolTipText(evt.getURL().toExternalForm()); } } if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) { pane.setCursor(Cursor.getDefaultCursor()); pane.setToolTipText(mTooltip); } if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { URL url = evt.getURL(); if (url != null) { Launch.openURL(url.toString()); } } } }, background); }