source: josm/trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java@ 2667

Last change on this file since 2667 was 1169, checked in by stoecker, 15 years ago

removed usage of tab stops

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import java.io.IOException;
5import java.net.MalformedURLException;
6import java.net.URL;
7
8import javax.swing.JApplet;
9
10import org.openstreetmap.josm.Main;
11
12/**
13 * Helper to open platform web browser on different platforms
14 *
15 * This now delegates the real work to a platform specific class.
16 *
17 * @author Imi
18 */
19public class OpenBrowser {
20
21 /**
22 * @return <code>null</code> for success or a string in case of an error.
23 */
24 public static String displayUrl(String url) {
25 if (Main.applet) {
26 try {
27 JApplet applet = (JApplet) Main.parent;
28 applet.getAppletContext().showDocument(new URL(url));
29 return null;
30 } catch (MalformedURLException mue) {
31 return mue.getMessage();
32 }
33 }
34
35 try {
36 Main.platform.openUrl(url);
37 } catch (IOException e) {
38 return e.getMessage();
39 }
40 return null;
41 }
42
43}
Note: See TracBrowser for help on using the repository browser.