本文整理汇总了Java中javax.swing.JTextPane.addHyperlinkListener方法的典型用法代码示例。如果您正苦于以下问题:Java JTextPane.addHyperlinkListener方法的具体用法?Java JTextPane.addHyperlinkListener怎么用?Java JTextPane.addHyperlinkListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextPane
的用法示例。
在下文中一共展示了JTextPane.addHyperlinkListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupPane
import javax.swing.JTextPane; //导入方法依赖的package包/类
public void setupPane(JTextPane pane, final File[] files, String fileNames, final File projectDir, final String url, final String revision) {
String msg = revision == null
? NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_DeleteDescription", fileNames, CMD_DIFF) //NOI18N
: NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_Description", fileNames, url, CMD_DIFF); //NOI18N
pane.setText(msg);
pane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
if(CMD_DIFF.equals(e.getDescription())) {
Context ctx = new Context(files);
DiffAction.diff(ctx, Setup.DIFFTYPE_REMOTE, NbBundle.getMessage(NotificationsManager.class, "LBL_Remote_Changes", projectDir.getName()), false); //NOI18N
} else if (revision != null) {
try {
SearchHistoryAction.openSearch(new SVNUrl(url), projectDir, Long.parseLong(revision));
} catch (MalformedURLException ex) {
LOG.log(Level.WARNING, null, ex);
}
}
}
}
});
}
示例2: createInfoPanel
import javax.swing.JTextPane; //导入方法依赖的package包/类
private static JTextPane createInfoPanel(String notification) {
JTextPane balloon = new JTextPane();
balloon.setContentType("text/html");
String text = getDetails(notification).replaceAll("(\r\n|\n|\r)", "<br>");
balloon.setText(text);
balloon.setOpaque(false);
balloon.setEditable(false);
balloon.setBorder(new EmptyBorder(0, 0, 0, 0));
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
//#134837
//http://forums.java.net/jive/thread.jspa?messageID=283882
balloon.setBackground(new Color(0, 0, 0, 0));
}
balloon.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
URLDisplayer.getDefault().showURL(e.getURL());
}
}
});
return balloon;
}