StockList.java
上传用户:whhzxy
上传日期:2009-12-31
资源大小:269k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. import javax.microedition.lcdui.*;
  2. /**
  3.   * 股票列表。
  4.   * @author 嘟嘟熊
  5.   * @version 1.0
  6.   */
  7. public class StockList
  8.     extends List
  9.     implements CommandListener {
  10.   private KMRichMan richManObject;
  11.   private PlayCanvas playCanvas;
  12.   /**
  13.     * 构造股票列表。
  14.     */
  15.   public StockList(KMRichMan kmrichman,PlayCanvas playCanvas) {
  16.     super("股票信息", 3);
  17.     this.richManObject = kmrichman;
  18.     this.playCanvas = playCanvas;
  19.     for (int i = 0; i < playCanvas.stock_name.length; i++) {
  20.       this.append(playCanvas.stock_name[i] +
  21.                   "(" + playCanvas.stock_price[i] + ")" +
  22.                   "[" + playCanvas.stock_amplitude[i] + "%]",null);
  23.     }
  24.     this.addCommand(new Command("返回",8,0));
  25.     setCommandListener(this);
  26.   }
  27.   /**
  28.    * 处理按键
  29.   */
  30.   public void commandAction(Command command, Displayable displayable) {
  31.     if (command.getLabel() == "返回") {
  32.       richManObject.setDisplayToPlayCanvas1();
  33.     }else
  34.       richManObject.setDisplayToStockForm(getSelectedIndex());
  35.   }
  36. }