Commit d37ef234 authored by SAPONE Alann's avatar SAPONE Alann

send mail corrected

parent ee753674
...@@ -62,6 +62,9 @@ import javax.swing.JOptionPane; ...@@ -62,6 +62,9 @@ import javax.swing.JOptionPane;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.cnrs.lam.cesam.vo.dnd.VoTable1DHelper; import org.cnrs.lam.cesam.vo.dnd.VoTable1DHelper;
import org.cnrs.lam.dis.etc.configuration.ConfigFactory; import org.cnrs.lam.dis.etc.configuration.ConfigFactory;
...@@ -80,7 +83,6 @@ import org.cnrs.lam.dis.etc.ui.SampListener; ...@@ -80,7 +83,6 @@ import org.cnrs.lam.dis.etc.ui.SampListener;
import org.cnrs.lam.dis.etc.ui.SessionListener; import org.cnrs.lam.dis.etc.ui.SessionListener;
import org.cnrs.lam.dis.etc.ui.SiteListener; import org.cnrs.lam.dis.etc.ui.SiteListener;
import org.cnrs.lam.dis.etc.ui.SourceListener; import org.cnrs.lam.dis.etc.ui.SourceListener;
import org.cnrs.lam.dis.etc.ui.UIManager;
import org.cnrs.lam.dis.etc.ui.generic.BuisnessListenerHolder; import org.cnrs.lam.dis.etc.ui.generic.BuisnessListenerHolder;
import org.cnrs.lam.dis.etc.ui.generic.DatasetListenerHolder; import org.cnrs.lam.dis.etc.ui.generic.DatasetListenerHolder;
import org.cnrs.lam.dis.etc.ui.generic.InfoProviderHolder; import org.cnrs.lam.dis.etc.ui.generic.InfoProviderHolder;
...@@ -109,7 +111,7 @@ import org.json.JSONObject; ...@@ -109,7 +111,7 @@ import org.json.JSONObject;
* *
* @author Nikolaos Apostolakos * @author Nikolaos Apostolakos
*/ */
public class EtcFrame extends javax.swing.JFrame implements UIManager { public class EtcFrame extends javax.swing.JFrame implements org.cnrs.lam.dis.etc.ui.UIManager {
/** /**
* *
......
...@@ -147,17 +147,15 @@ public class AboutDialog extends HelpDialog { ...@@ -147,17 +147,15 @@ public class AboutDialog extends HelpDialog {
Font fontContact = contactLabel.getFont(); Font fontContact = contactLabel.getFont();
Font boldFontContact = new Font(fontContact.getFontName(), Font.BOLD, fontContact.getSize()); Font boldFontContact = new Font(fontContact.getFontName(), Font.BOLD, fontContact.getSize());
contactLabel.setFont(boldFontContact); contactLabel.setFont(boldFontContact);
String contactURL = "<html><a href=\"" + CONTACT_URL + "\">"+ CONTACT_URL +"</a></html>"; String contactURL = "<html><a href='" + CONTACT_URL + "'>"+ CONTACT_URL +"</a></html>";
JLabel contactUrlLabel = new JLabel(contactURL); JLabel contactUrlLabel = new JLabel(contactURL);
contactUrlLabel.setAlignmentX(LEFT_ALIGNMENT); contactUrlLabel.setAlignmentX(LEFT_ALIGNMENT);
contactUrlLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); contactUrlLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
contactUrlLabel.addMouseListener(new MouseAdapter() contactUrlLabel.addMouseListener(new MouseAdapter()
{ {
public void mouseClicked(MouseEvent e) public void mouseClicked(MouseEvent evt)
{ {
try { UtilsLoader.openMail(CONTACT_URL);
UtilsLoader.openMail(new URL(CONTACT_URL));
} catch (MalformedURLException e1) {}
} }
}); });
......
...@@ -16,10 +16,16 @@ public class UtilsLoader { ...@@ -16,10 +16,16 @@ public class UtilsLoader {
} }
} }
public static void openMail(URL url) { public static void openMail(String urlString) {
try { System.out.println(urlString);
Desktop.getDesktop().mail(new URI("mailto:" + url + "?subject=ETC-42")); Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
} catch (IOException | URISyntaxException e) {} if (desktop != null && desktop.isSupported(Desktop.Action.MAIL)) {
try {
Desktop.getDesktop().mail(new URI("mailto:" + urlString + "?subject=ETC-42"));
} catch (IOException | URISyntaxException e) {
System.out.println(e.getMessage());
}
}
} }
public static void openWebpage(URL url) { public static void openWebpage(URL url) {
......
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment