第6回: 実機対応と携帯電話の将来展望
001: package com.s_cradle.improve.client; 002: 003: import javax.microedition.lcdui.Form; 004: import javax.microedition.lcdui.Item; 005: import javax.microedition.lcdui.StringItem; 006: import com.s_cradle.improve.Constants; 007: 008: /** 009: * Copyright (C) 2003 Sophia Cradle, Inc. 010: * 011: * 2択の Menu です。 012: * 013: * @author Masaru Yoshimura 014: */ 015: public class TwoChoiceMenu extends Menu{ 016: // 何に使われているかの定数 017: public static final int MENU_WITHDRAW = 0; 018: public static final int MENU_QUIT = 1; 019: public static final int MENU_REMOVEBUDDY = 2; 020: public static final int MENU_PHONE = 3; 021: 022: private static final String[] ITEMS = new String[]{"はい","いいえ"}; 023: private static final int YES = 0; 024: private static final int NO = 1; 025: 026: private int mode; 027: private Buddy buddy; 028: 029: /** 030: * コンストラクタ 031: */ 032: public TwoChoiceMenu(String title, int mode_) { 033: super(title, ITEMS, true); 034: mode = mode_; 035: } 036: 037: /** 038: * コンストラクタ 039: */ 040: public TwoChoiceMenu(String title, int mode_, Buddy buddy_) { 041: this(title, mode_); 042: buddy = buddy_; 043: } 044: 045: /** 046: * キーハンドラ 047: */ 048: public Menu processFireKeyRelease(){ 049: switch( mode ){ 050: case MENU_WITHDRAW: 051: if( cursor == YES ){ 052: Task.getTask(Task.TASK_DELETE,new String[0]).schedule(0); 053: } 054: break; 055: case MENU_QUIT: 056: if( cursor == YES ){ 057: Task.getTask(Task.TASK_SET,new String[]{ 058: String.valueOf(Constants.ITEM_INDEX_STATUS), 059: String.valueOf(Constants.STATUS_LOGOFF)}) 060: .schedule(0); 061: } 062: break; 063: case MENU_REMOVEBUDDY: 064: if( cursor == YES ){ 065: Task task = Task.getTask(Task.TASK_REMOVE, 066: new String[]{buddy.getAccount()}); 067: task.schedule(0); 068: } 069: break; 070: case MENU_PHONE: 071: if( cursor == YES ){ 072: //電話処理 073: } 074: break; 075: default: 076: break; 077: } 078: 079: return null; 080: } 081: }