public void startApp() { try { ImplementationFactory.setInstance(new MobrizImplementationFactory()); Display.init(this); InputStream stream = getClass().getResourceAsStream("/dhismobile.res"); Resources theme = Resources.open(stream); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); // <editor-fold defaultstate="collapsed" desc=" Initialize Record Store "> new Thread( new Runnable() { public void run() { try { // <editor-fold defaultstate="collapsed" desc=" Check if store exists "> dataStore = RecordStore.openRecordStore("dataStore", true); if (dataStore.getNumRecords() == 0) { firstRun = true; } else { firstRun = false; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Create RecordStore with 90 rows // "> if (firstRun) { for (int i = 0; i < 90; i++) { try { dataStore.addRecord("".getBytes(), 0, "".getBytes().length); } catch (RecordStoreException rsex) { rsex.printStackTrace(); } } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Check if any previous msg Stored // "> else { if (dataStore.getRecord(10) != null) { String checkSaved = new String(dataStore.getRecord(10)); if (checkSaved.equals("true")) { savedMsg = true; } } } // </editor-fold> } catch (RecordStoreException ex) { ex.printStackTrace(); } } }) .start(); // </editor-fold> showSplashScreen(); } catch (Exception ex) { ex.printStackTrace(); } }
private void installTheme() { // This is not the normal way to do this. // Usually you load a theme from a file. /* */ try { Resources r = Resources.open("/res/javaTheme.res"); UIManager.getInstance().setThemeProps(r.getTheme("javaTheme")); // Resources r = Resources.open("/res/businessTheme.res"); // UIManager.getInstance().setThemeProps(r.getTheme("businessTheme")); } catch (IOException ioe) { System.out.println("Couldn't load theme."); } /*UIManager uim = UIManager.getInstance(); Hashtable ht = new Hashtable(); ht.put("sel#" + Style.BG_COLOR, "d0d0ed"); ht.put(Style.BG_COLOR, "ffffff"); ht.put(Style.FG_COLOR, "000056"); uim.setThemeProps(ht); */ }
private final void show() { form.setTransitionInAnimator( UIManager.getInstance().getLookAndFeel().getDefaultFormTransitionIn()); form.show(); }