List of usage examples for javax.swing JEditorPane HONOR_DISPLAY_PROPERTIES
String HONOR_DISPLAY_PROPERTIES
To view the source code for javax.swing JEditorPane HONOR_DISPLAY_PROPERTIES.
Click Source Link
From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.GiftCloudDialogs.java
public void showMessage(final String message) throws HeadlessException { final JPanel messagePanel = new JPanel(new GridBagLayout()); final JEditorPane textField = new JEditorPane(); textField.setContentType("text/html"); textField.setText(message);/*from w w w .j a va2s. co m*/ textField.setEditable(false); textField.setBackground(null); textField.setBorder(null); textField.setEditable(false); textField.setForeground(UIManager.getColor("Label.foreground")); textField.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); textField.setFont(UIManager.getFont("Label.font")); textField.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException e1) { // Ignore failure to launch URL } catch (URISyntaxException e1) { // Ignore failure to launch URL } } } } }); messagePanel.add(textField); textField.setAlignmentX(SwingConstants.CENTER); JOptionPane.showMessageDialog(mainFrame.getContainer(), messagePanel, applicationName, JOptionPane.INFORMATION_MESSAGE, icon); }