protected void beforeMyProfile(Form f) { Myprofile = f; Label l1 = (Label) findByName("propic", f); name = (TextField) findByName("name", Myprofile); index = (TextField) findByName("index", Myprofile); tel = (TextField) findByName("tel", Myprofile); addr = (TextField) findByName("addr", Myprofile); email = (TextField) findByName("email", Myprofile); group = (TextField) findByName("group", Myprofile); try { String userde[] = Splitter.Split(new String(record.getRecord(4)), "-"); name.setText(userde[0]); index.setText(userde[1]); tel.setText(userde[2]); addr.setText(userde[3]); email.setText(userde[4]); group.setText(userde[5]); if (new String(record.getRecord(2)).equals("no")) { l1.setIcon(Image.createImage("/no_user.png").scaledHeight(72)); } else { l1.setIcon(Image.createImage(new String(record.getRecord(2))).scaledHeight(72)); } System.gc(); } catch (Exception e) { } super.beforeMyProfile(f); }
/** Shows the ListDemo main view. Displays a confirmation query if needed. */ protected void back() { if (hasChanged() && confirmationQuery) { int[] tmp = new int[originalSelectedIndices.length]; System.arraycopy(originalSelectedIndices, 0, tmp, 0, tmp.length); if (Dialog.show("save changes", "Save changes made?", "Yes", "No")) { showSelectedDialog(); // Proceed with the changes } else { setSelectedIndices(tmp); // Abandon changes DemoMidlet.getMainForm().show(); } } else { DemoMidlet.getMainForm().show(); } }
protected void beforeDepartments(Form f) { department = f; Label l = (Label) findByName("Label2", f); try { HttpCon con12 = new HttpCon( String.valueOf(departmentPerson) + "-p", PropertyClass.ServerUrl + "DepartmentOffiecer"); con12.SetContype(true, true, true); Thread t = new Thread(con12); synchronized (t) { t.start(); t.wait(); } String a[] = Splitter.Split(con12.getValue().toString(), "-"); ((Label) findByName("Label3", f)).setText(a[4]); ((TextArea) findByName("aboutDepartmentt", f)).setText(a[0]); ((Label) findByName("name", f)).setText("Head Dept: " + a[1]); ((Label) findByName("Label7", f)).setText(a[2]); ((Label) findByName("Label8", f)).setText("Tel : " + a[3]); switch (departmentPerson) { case 1: l.setIcon(Image.createImage("/ceo.png").scaledHeight(78)); break; case 2: l.setIcon(Image.createImage("/div1.png").scaledHeight(78)); break; case 3: l.setIcon(Image.createImage("/div2.png").scaledHeight(78)); break; case 4: l.setIcon(Image.createImage("/div3.png").scaledHeight(78)); break; default: l.setIcon(Image.createImage("no_user.png").scaledHeight(78)); break; } departmentPerson = 0; super.beforeDepartments(f); System.gc(); } catch (Exception e) { } }
protected void beforeLoginGUI(Form f) { Login = f; username = (TextField) findByName("Username", f); password = (TextField) findByName("Password", f); password.setConstraint(TextField.PASSWORD); try { record = RecordStore.openRecordStore("recordpr", true); } catch (Exception e) { } try { record.getRecord(1); } catch (Exception e) { byte[] defaultlogin = "******".getBytes(); byte image[] = "no".getBytes(); byte prio[] = "0-0-0".getBytes(); byte[] userdetail = "n-n-n-n-n-n".getBytes(); try { record.addRecord(defaultlogin, 0, defaultlogin.length); // 1 record.addRecord(image, 0, image.length); // 2 record.addRecord(prio, 0, prio.length); // 3 record.addRecord(userdetail, 0, userdetail.length); defaultlogin = null; image = null; prio = null; userdetail = null; System.gc(); } catch (Exception e1) { System.out.println(e1); } } super.beforeLoginGUI(f); }