peopleresults.java

来自「j2me实现的移动警务的大概框架」· Java 代码 · 共 170 行

JAVA
170
字号
package PoliceSearch.IntegratedInformation.People;

import javax.microedition.lcdui.*;

import PoliceSearch.*;
import PoliceSearch.Com.*;
import PoliceSearch.IntegratedInformation.*;

/**
 * <p>Title: 公安查询系统</p>
 * <p>Description: 章桂华</p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: otheno</p>
 * @author 章桂华等
 * @version 1.0
 */

public class PeopleResults
    extends Form
    implements CommandListener, ItemCommandListener {

  private final static String[] strManTitle = {
      "证件号码", "姓名", "性别", "绰号", "曾用名", "民族", "籍贯", "常居地", "当前临时住所", "出生日期",
      "年龄", "身高", "本人照片",
      "单位", "单位电话", "同户人员", "联系电话", "是否驾驶员", "犯罪纪录", "住所类型", "其它"};

  private final static String[] strManRst = {
      "321032196509124329", "王东", "男", "猴子", "王志东", "汉", "江西九江", "九江市北大街21号",
      "南昌市招待所202", "19650912", "41", "171", "  ",
      "九江市第一人民医院", "8762587", "  王志强等", "13628292344", "是", "  ", "出差", "没有"};

  public final int[] intSpaPos = {
      12, 15, 17, 18};

  Image bmpPolice = null;
  public String strPath = "/img/police.png";
  public String strPic = "/img/people/photo.png";
  public String strOtherPeoplePic = "/img/people/other/photo1.png";
  Form dispTishiForm = null;

  StringItem[] itemLinkPic = {
      null, null, null, null};
  public String[] strItemLinkInf = {
      "放大", "详细", "违章记录", "犯罪纪录"};

  IntegratedInfMenu parent;
  TextField textField1;
  public PeopleResults(IntegratedInfMenu peopleCon) {
    super("查询人要数结果");
    parent = peopleCon;
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit() {
    textField1 = new TextField("", "", 15, TextField.ANY);
//    this.append(textField1);
    try {
      bmpPolice = Image.createImage(strPath);
      this.append(bmpPolice);
//      Graphics g = bmpPolice.getGraphics();
//      g.drawImage(bmpPolice, 0, 0, g.TOP|g.VCENTER);
//      textField1.setString("成功");
    }
    catch (Exception e1) {
//      textField1.setString("失败");
      e1.printStackTrace();
    }
    String strTemp = "";
    int k = 0;
    for (int i = 0; i < strManTitle.length; i++) {
      strTemp = strManTitle[i] + ":" + strManRst[i];
      int j = 0;
      for (j = 0; j < intSpaPos.length; j++) {
        if (i == intSpaPos[j]) {
          break;
        }
      }
      if (j >= intSpaPos.length) {
        this.append(new StringItem(strManTitle[i] + ":", strManRst[i]));
      }
      else {
        strTemp = strManTitle[i] + strManRst[i];
        itemLinkPic[k] = new StringItem(strTemp, strItemLinkInf[k],
                                        Item.HYPERLINK);
        itemLinkPic[k].setDefaultCommand(Resources.Cmd_Help);
        itemLinkPic[k].setItemCommandListener(this);
        this.append(itemLinkPic[k]);
        k++;
      }
    }
    this.addCommand(Resources.Cmd_Back);
    setCommandListener(this);
  }

  public void commandAction(Command c, Item item) {
    if (c == Resources.Cmd_Help) {
      if (itemLinkPic[0] == item) { //"照片"
        dispTishiForm = new Form(strItemLinkInf[0]);
        try {
          bmpPolice = Image.createImage(strPic);
          dispTishiForm.append(bmpPolice);
        }
        catch (Exception e) {
          e.printStackTrace();
//          textField1.setString("失败2");
        }
        dispTishiForm.addCommand(Resources.Cmd_Queren);
        dispTishiForm.setCommandListener(this);
        Display.getDisplay(PoliceMain.instance).setCurrent(dispTishiForm);
      } //0
      if (itemLinkPic[1] == item) { //"同户人员"
        dispTishiForm = new Form(strItemLinkInf[1]);
        dispTishiForm.append(new StringItem("", "同户人:王志强"));
        try {
          bmpPolice = Image.createImage(strOtherPeoplePic);
          dispTishiForm.append(bmpPolice);
        }
        catch (Exception e) {
          e.printStackTrace();
        }
        dispTishiForm.append(new StringItem("简单介绍",
            "王志强,男,1972年9月23日出生,在沙轮厂工作,目前业务科科长,中国共产党党员,2001年取的驾驶执照"));
        dispTishiForm.addCommand(Resources.Cmd_Queren);
        dispTishiForm.setCommandListener(this);
        Display.getDisplay(PoliceMain.instance).setCurrent(dispTishiForm);
      } //1
      if (itemLinkPic[2] == item) { //"违章记录"
        dispTishiForm = new Form(strItemLinkInf[2]);
        dispTishiForm.append(new StringItem("", "违章记录"));
        dispTishiForm.append(new StringItem("",
                                            "1--2001年3月21日,在火车站门口乱停车,罚款50,扣2分"));
        dispTishiForm.append(new StringItem("", "2--2002年7月1日,在大桥边乱停车,罚款50,扣2分"));
        dispTishiForm.append(new StringItem("", "3--2005年3月9日,酒后驾车,罚款500,扣3分"));
        dispTishiForm.append(new StringItem("", "4--2006年4月3日,冲撞红灯,罚款500,扣3分"));
        dispTishiForm.addCommand(Resources.Cmd_Queren);
        dispTishiForm.setCommandListener(this);
        Display.getDisplay(PoliceMain.instance).setCurrent(dispTishiForm);
      } //2
      if (itemLinkPic[3] == item) { //"犯罪纪录"
        dispTishiForm = new Form(strItemLinkInf[2]);
        dispTishiForm.append(new StringItem("犯罪记录", ""));
        dispTishiForm.append(new StringItem("", "没有"));
        dispTishiForm.addCommand(Resources.Cmd_Queren);
        dispTishiForm.setCommandListener(this);
        Display.getDisplay(PoliceMain.instance).setCurrent(dispTishiForm);
      } //3
    } //end c ==
  }

  public void commandAction(Command c, Displayable d) {
    if ( (d == this) && (c == Resources.Cmd_Back)) {
      parent.displaySubMenu();
    }
    if ( (d == dispTishiForm) && (c == Resources.Cmd_Queren)) {
      display();
    }
  }

  /**
   * 功能:显示当前页面
   */
  public void display() {
    Display.getDisplay(PoliceMain.instance).setCurrent(this);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?