KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > jnlp > Main


1 package hudson.jnlp;
2
3 import javax.swing.SwingUtilities JavaDoc;
4 import javax.swing.JOptionPane JavaDoc;
5 import java.io.StringWriter JavaDoc;
6 import java.io.PrintWriter JavaDoc;
7
8 /**
9  * @author Kohsuke Kawaguchi
10  */

11 public class Main {
12
13     public static void main(String JavaDoc[] args) {
14         // see http://forum.java.sun.com/thread.jspa?threadID=706976&tstart=0
15
// not sure if this is the cause, but attempting to fix
16
// https://hudson.dev.java.net/issues/show_bug.cgi?id=310
17
// by overwriting the security manager.
18
System.setSecurityManager(null);
19
20         GUI.setUILookAndFeel();
21         final MainDialog frame = new MainDialog();
22         frame.setVisible(true);
23
24         Engine engine = new Engine(new Listener() {
25             public void status(final String JavaDoc msg) {
26                 SwingUtilities.invokeLater(new Runnable JavaDoc() {
27                     public void run() {
28                         frame.status(msg);
29                     }
30                 });
31             }
32
33             public void error(final Throwable JavaDoc t) {
34                 SwingUtilities.invokeLater(new Runnable JavaDoc() {
35                     public void run() {
36                         StringWriter JavaDoc sw = new StringWriter JavaDoc();
37                         t.printStackTrace(new PrintWriter JavaDoc(sw));
38                         JOptionPane.showMessageDialog(
39                             frame,sw.toString(),"Error",
40                             JOptionPane.ERROR_MESSAGE);
41                         System.exit(-1);
42                     }
43                 });
44             }
45         }, args[0], args[1], args[2], args[3]);
46         engine.start();
47     }
48 }
49
Popular Tags