List of usage examples for javax.swing JEditorPane setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:org.jajuk.ui.views.SuggestionView.java
/** * Gets the nothing found panel.//w w w . j a va2 s. co m * * @return a panel with text explaining why no item has been found */ JPanel getNothingFoundPanel() { JPanel out = new JPanel(new MigLayout("ins 5", "grow")); JEditorPane jteNothing = new JEditorPane("text/html", Messages.getString("SuggestionView.7")); jteNothing.setBorder(null); jteNothing.setEditable(false); jteNothing.setOpaque(false); jteNothing.setToolTipText(Messages.getString("SuggestionView.7")); out.add(jteNothing, "center,grow"); return out; }
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 w w w. 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); }