01: /**********************************************************************************
02:
03: Feedzeo!
04: A free and open source RSS/Atom/RDF feed aggregator
05:
06: Copyright (C) 2005-2006 Anand Rao (anandrao@users.sourceforge.net)
07:
08: This library is free software; you can redistribute it and/or
09: modify it under the terms of the GNU Lesser General Public
10: License as published by the Free Software Foundation; either
11: version 2.1 of the License, or (at your option) any later version.
12:
13: This library is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: Lesser General Public License for more details.
17:
18: You should have received a copy of the GNU Lesser General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21:
22: ************************************************************************************/package util;
23:
24: import java.net.*;
25: import org.jdesktop.jdic.desktop.*;
26:
27: public class DefaultBrowser extends Thread {
28: String IPAddr;
29: int portno;
30:
31: public DefaultBrowser(String IPAddr, int portno) {
32: this .IPAddr = IPAddr;
33: this .portno = portno;
34: }
35:
36: private void LaunchDefaultBrowser() {
37: try {
38: String url = "http://" + IPAddr + ":" + portno
39: + "/index.html";
40: System.out.println("Launching default browser with URL:"
41: + url);
42: Desktop.browse(new URL(url));
43: } catch (Exception e) {
44: ExceptionUtil.reportException(e);
45: }
46: }
47:
48: public void run() {
49: try {
50: // show Status
51: WinUtil.showOneLineWinMsg("Launching Web browser ...");
52: LaunchDefaultBrowser();
53: WinUtil.hideOneLineWinMsg();
54: while (true)
55: sleep(100);
56: } catch (Exception e) {
57: ExceptionUtil.reportException(e);
58: }
59: }
60:
61: }
|