国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

J2ME MIDP 提供的最重要的圖形元素

2019-11-17 06:23:46
字體:
供稿:網(wǎng)友

  MIDP API 盡管維護(hù)的是一個(gè)受限的框架,但它還是提供了 UI 元素的完整集合。以下是最重要的 UI 元素中的一些:
  
  Alert 用于在屏幕上向用戶顯示關(guān)于異常情況或錯(cuò)誤的信息。
  
  Choice 用于實(shí)現(xiàn)從既定數(shù)量的選項(xiàng)中進(jìn)行選擇。
  
  ChoiceGroup 提供一組相關(guān)選項(xiàng)。
  
  Form 作為其它 UI 元素的容器。
  
  List 提供一個(gè)選項(xiàng)列表。
  
  StringItem 充當(dāng)只顯(display-only)字符串之用。
  
  TextBox 是答應(yīng)用戶輸入和編輯文本的屏幕顯示。
  
  TextField 答應(yīng)用戶輸入和編輯文本。多個(gè) TextField 可放到一個(gè) Form 中。
  
  DateField 是一個(gè)可編輯的組件,用于表示日期和時(shí)間信息。DateField 可以放到 Form 中。
  
  Ticker 用于文本的可滾動(dòng)顯示。
  
  一個(gè)樣本應(yīng)用程序:電話日歷
  J2ME 的聞名特色之一是它在受限環(huán)境中的日期處理功能。J2ME 提供的 DateField UI 元素是一個(gè)可編輯的組件,該組件用于表示日歷信息(即日期和時(shí)間)。在這一部分中,我們將使用 DateField 和 Date 函數(shù)來開發(fā)一個(gè) J2ME 應(yīng)用程序,這個(gè)應(yīng)用程序用于在移動(dòng)電話 UI 上顯示一個(gè)滾動(dòng)日歷。
  
  // Import of API classes
  import javax.microedition.midlet.*;
  import javax.microedition.lcdui.*;
  import java.util.*;
  
  //A first MIDlet with simple text and a few commands.
  public class PhoneCalendar extends MIDlet
  implements CommandListener, ItemStateListener {
  
  //The commands
  PRivate Command exitCommand;
  
  //The display for this MIDlet
  private Display display;
  
  // Display items e.g Form and DateField
  Form displayForm;
  DateField date;
  
  public PhoneCalendar() {
   display = Display.getDisplay(this);
  exitCommand = new Command("Exit", Command.SCREEN, 1);
   date = new DateField("Select to date", DateField.DATE);
  
  }
  
  // Start the MIDlet by creating the Form and
  // associating the exit command and listener.
  public void startApp() {
  displayForm = new Form("Quick Calendar");
   displayForm.append(date);
   displayForm.addCommand(exitCommand);
  displayForm.setCommandListener(this);
  displayForm.setItemStateListener(this);
  display.setCurrent(displayForm);
  }
  
  public void itemStateChanged(Item item)
  {
  // Get the values from changed item
  }
  
  // Pause is a no-op when there is no background
  // activities or record stores to be closed.
  public void pauseApp() { }
  
  // Destroy must cleanup everything not handled
  // by the garbage collector.
  public void destroyApp (boolean unconditional) { }
  
  // Respond to commands. Here we are only implementing
  // the exit command. In the exit command, cleanup and
  // notify that the MIDlet has been destroyed.
  public void commandAction (
  Command c, Displayable s) {
  if (c == exitCommand) {
  destroyApp(false);
   notifyDestroyed();
  }
  }
  }

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 宜春市| 武安市| 宜章县| 永修县| 专栏| 南开区| 昭觉县| 霞浦县| 平舆县| 车险| 布尔津县| 浮梁县| 卓资县| 安福县| 吴川市| 历史| 克山县| 泗洪县| 二连浩特市| 平武县| 建湖县| 南皮县| 西畴县| 肥西县| 忻城县| 达孜县| 惠水县| 岗巴县| 龙州县| 邹城市| 新津县| 珠海市| 东乡族自治县| 武川县| 德格县| 米脂县| 临沂市| 额敏县| 东乡| 略阳县| 雷山县|