Esempio n. 1
0
 private void launchClass(String full_class_name) {
   Class c;
   try {
     c = Class.forName(full_class_name);
     Method m = c.getMethod("main", new Class[] {String[].class});
     m.invoke(null, new Object[] {null});
   } catch (Throwable t) {
     String message = "Error occurred when calling main(String[]) on class " + full_class_name;
     DemoUtility.showErrorDialog(this, message, t);
   }
 }
Esempio n. 2
0
  public static void main(String[] args) {
    try {
      final AllDemos a = new AllDemos();
      a.setDefaultCloseOperation(AllDemos.EXIT_ON_CLOSE);
      DemoUtility.setDemoDisableExitOnClose();
      SwingUtility.centerOnScreen(a);
      a.setVisible(true);

      for (int i = 0; i < args.length; i++) {
        final String full_class_name = args[i];
        SwingUtilities.invokeLater(
            new Runnable() {
              public void run() {
                a.launchClass(full_class_name);
              }
            });
      }
    } catch (Throwable t) {
      t.printStackTrace();
      System.exit(-1);
    }
  }