Пример #1
0
  private void testMain() {
    System.out.println("the Begin");

    try {

      BPEnvironment bpenv = Blueprint.Util.getInstance().defaultEnvironment();
      bpenv.loadNamespace(EomReflectInfo.class, true);
      bpenv.loadNamespace(AwtNamespaceInfo.class, true);
      bpenv.loadNamespace(SwingNamespaceInfo.class, true);

      System.out.println("now load a testing xml doc.");

      BPDocument doc = Blueprint.Util.loadDocument("resource:///test-swing.xml");
      JFrame frame = (JFrame) doc.getRootElement().getTarget();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);

    } catch (Exception e) {
      e.printStackTrace();
    }

    System.out.println("the End");
  }
Пример #2
0
  public static void main(String[] arg) {

    try {
      String uri = R.file.Main_xml;
      BPEnvironment envi = Blueprint.Util.getInstance().defaultEnvironment();

      Class<?>[] info_list = {
        EomReflectInfo.class, AwtNamespaceInfo.class, SwingNamespaceInfo.class
      };
      for (Class<?> info : info_list) {
        envi.loadNamespace(info, true);
      }

      BPDocument doc = envi.loadDocument(URI.create(uri));
      JFrame frame = (JFrame) doc.getRootElement().getTarget(true);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }