Guest User

Untitled

a guest
Feb 21st, 2018
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public void showInfoDialog() {
  2. final JEditorPane editorPane = new JEditorPane();
  3. editorPane.setPreferredSize(new Dimension(520, 180));
  4. editorPane.setEditable(false);
  5. editorPane.setContentType("text/html");
  6.  
  7. editorPane.addHyperlinkListener(new HyperlinkListener() {
  8. @Override
  9. public void hyperlinkUpdate(HyperlinkEvent e) {
  10. if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
  11. if (Desktop.isDesktopSupported()) {
  12. try {
  13. Desktop.getDesktop().browse(e.getURL().toURI());
  14. } catch (IOException e1) {
  15. e1.printStackTrace();
  16. } catch (URISyntaxException e1) {
  17. e1.printStackTrace();
  18. }
  19. }
  20. }
  21. }
  22. });
  23.  
  24. String message = "<html>Autor: Martin Sobek<br> e-mail: <a href=\"mailto:masodj@centrum.cz\">masodj@centrum.cz</a> </html>";
  25. editorPane.setText(message);
  26. JOptionPane.showMessageDialog(this, editorPane, "Informace",
  27. JOptionPane.INFORMATION_MESSAGE);
  28. }
Add Comment
Please, Sign In to add comment