コード例 #1
0
 public Container startApp(Resources res, String resPath, boolean loadTheme) {
   initVars();
   UIBuilder.registerCustomComponent("Button", com.codename1.ui.Button.class);
   UIBuilder.registerCustomComponent("ComponentGroup", com.codename1.ui.ComponentGroup.class);
   UIBuilder.registerCustomComponent("MapComponent", com.codename1.maps.MapComponent.class);
   UIBuilder.registerCustomComponent("Tabs", com.codename1.ui.Tabs.class);
   UIBuilder.registerCustomComponent("MultiButton", com.codename1.components.MultiButton.class);
   UIBuilder.registerCustomComponent("Form", com.codename1.ui.Form.class);
   UIBuilder.registerCustomComponent("Label", com.codename1.ui.Label.class);
   UIBuilder.registerCustomComponent("TextArea", com.codename1.ui.TextArea.class);
   UIBuilder.registerCustomComponent("Container", com.codename1.ui.Container.class);
   if (loadTheme) {
     if (res == null) {
       try {
         if (resPath.endsWith(".res")) {
           res = Resources.open(resPath);
           System.out.println(
               "Warning: you should construct the state machine without the .res extension to allow theme overlays");
         } else {
           res = Resources.openLayered(resPath);
         }
       } catch (java.io.IOException err) {
         err.printStackTrace();
       }
     }
     initTheme(res);
   }
   if (res != null) {
     setResourceFilePath(resPath);
     setResourceFile(res);
     initVars(res);
     return showForm("Main", null);
   } else {
     Form f = (Form) createContainer(resPath, "Main");
     initVars(fetchResourceFile());
     beforeShow(f);
     f.show();
     postShow(f);
     return f;
   }
 }
コード例 #2
0
 public Container createWidget(Resources res, String resPath, boolean loadTheme) {
   initVars();
   UIBuilder.registerCustomComponent("Button", com.codename1.ui.Button.class);
   UIBuilder.registerCustomComponent("ComponentGroup", com.codename1.ui.ComponentGroup.class);
   UIBuilder.registerCustomComponent("MapComponent", com.codename1.maps.MapComponent.class);
   UIBuilder.registerCustomComponent("Tabs", com.codename1.ui.Tabs.class);
   UIBuilder.registerCustomComponent("MultiButton", com.codename1.components.MultiButton.class);
   UIBuilder.registerCustomComponent("Form", com.codename1.ui.Form.class);
   UIBuilder.registerCustomComponent("Label", com.codename1.ui.Label.class);
   UIBuilder.registerCustomComponent("TextArea", com.codename1.ui.TextArea.class);
   UIBuilder.registerCustomComponent("Container", com.codename1.ui.Container.class);
   if (loadTheme) {
     if (res == null) {
       try {
         res = Resources.openLayered(resPath);
       } catch (java.io.IOException err) {
         err.printStackTrace();
       }
     }
     initTheme(res);
   }
   return createContainer(resPath, "Main");
 }