📄 auctiondemo_ja.java
字号:
} } else if (obj == bandList) { if (c == List.SELECT_COMMAND) { int idx = obj.getSelectedIndex(); String bandName = band.getName(idx); ticketList.setTitle(bandName); reconstructList(ticketList, band.getTicketList(bandName)); display.setCurrent(ticketList); } else if (c == BACK_CMD) { display.setCurrent(aucMenu); } } else if (obj == ticketList) { if (c == List.SELECT_COMMAND) { int idx = obj.getSelectedIndex(); String bandName = ticketList.getTitle(); if (chooseBandType == 0) { ticketForm.setTitle(bandName); ticketForm.delete(0); ticketForm.append(band.getTicketData(bandName, idx)); display.setCurrent(ticketForm); } else if (chooseBandType == 1) { login.setID(bandName, band.getTicketID(bandName, idx)); bidForm.setTitle(null); StringItem item = new StringItem("", band.getTicketBidTitle(bandName, idx)); bidForm.set(0, item); display.setCurrent(bidForm); } else if (chooseBandType == 2) { display.setCurrent(enterForm); } } else if (c == BACK_CMD) { display.setCurrent(bandList); } } else if (obj == setMenu) { if (c == List.SELECT_COMMAND) { int idx = obj.getSelectedIndex(); switch (idx) { case 0: date.setDate(); display.setCurrent(date); break; case 1: display.setCurrent(setTicker); break; case 2: display.setCurrent(updateInt); break; case 3: display.setCurrent(addBand); break; case 4: display.setCurrent(rmBand); break; } } else if (c == BACK_CMD) { display.setCurrent(aucMenu); } } } else if (s instanceof Form) { Form obj = (Form) s; if (obj == ticketForm) { if (c == BACK_CMD) { display.setCurrent(ticketList); } else if (c == MENU_CMD) { display.setCurrent(aucMenu); } } else if (obj == bidForm) { if (c == BACK_CMD) { display.setCurrent(ticketList); } else if (c == NEXT_CMD) { login.setBid(ticketList.getTitle(), bidText.getString()); display.setCurrent(login); } } else if (obj == enterForm) { if (c == BACK_CMD) { display.setCurrent(ticketList); } else if (c == SAVE_CMD) { updateAlert.set(ticketList.getTitle(), enterText.getString()); display.setCurrent(alertMsg, aucMenu); } } } else if (s instanceof TextBox) { TextBox obj = (TextBox) s; if (obj == addBand) { if (c == BACK_CMD) { display.setCurrent(setMenu); } else if (c == SAVE_CMD) { updateBandList(addBand.getString()); display.setCurrent(savedMsg, setMenu); } } } } class Login extends Form implements CommandListener { TextField id = new TextField("", "", 10, TextField.ANY); TextField pd = new TextField("", "", 10, (TextField.NUMERIC|TextField.PASSWORD)); Form confirm = new Form("\u78ba\u8a8d"); Form notice = new Form("\u901a\u77e5"); Login() { super(null); append("\u30e6\u30fc\u30b6\u30fcID:"); append(id); append("\u30d1\u30b9\u30ef\u30fc\u30c9:"); append(pd); addCommand(BACK_CMD); addCommand(NEXT_CMD); setCommandListener(this); confirm.append("dummy"); confirm.addCommand(BACK_CMD); confirm.addCommand(SUBMIT_CMD); confirm.setCommandListener(this); notice.append("\u3042\u306a\u305f\u306e\u5165\u672d\u306f\n"); notice.append("\u9818\u53ce\u3055\u308c\u307e\u3057\u305f\n"); notice.append("\u78ba\u8a8d\u756a\u53f7:\n"); notice.append("12-B455-31"); notice.addCommand(BACK_CMD); notice.addCommand(MENU_CMD); notice.setCommandListener(this); } String band, bid, ticketID; void setBid(String band, String bid) { this.band = band; this.bid = bid; } void setID(String band, String ticketID) { this.band = band; this.ticketID = ticketID; } public void commandAction(Command c, Displayable s) { if (s instanceof Form) { Form obj = (Form) s; if (obj == this) { if (c == BACK_CMD) { display.setCurrent(bidForm); } else if (c == NEXT_CMD) { String str = "\u756a\u53f7: " + ticketID + "\n" + band + "\n" + "\u5165\u672d\u984d:\n" + bid + "\u5186"; confirm.delete(0); confirm.append(str); display.setCurrent(confirm); } } else if (obj == confirm) { if (c == BACK_CMD) { display.setCurrent(bidForm); } else if (c == SUBMIT_CMD) { // display.setCurrent(submitMsg, notice); TimerService = new Timer(); TimerClient timerClient = new TimerClient(); TimerService.schedule(timerClient, 0, 1000); display.setCurrent(submitMsg); } } else if (obj == notice) { if (c == BACK_CMD) { display.setCurrent(bidForm); } else if (c == MENU_CMD) { display.setCurrent(aucMenu); } } } } private class TimerClient extends TimerTask { public final void run() { if (submitGauge.getValue() == submitGauge.getMaxValue()) { TimerService.cancel(); submitGauge.setValue(0); display.setCurrent(notice); } else { submitGauge.setValue(submitGauge.getValue()+10); } } } } class SetDate extends Form implements CommandListener { DateField dateTimeItem = new DateField(null, DateField.DATE_TIME); SetDate() { super(null); append("\u5165\u672d\u3092\u884c\u3046\u524d\u306b\u6642" + "\u523b\u3092\u3053\u306e\u30b9\u30af\u30ea\u30fc" + "\u30f3\u3067\u8a2d\u5b9a\u3067\u304d\u307e\u3059\n"); append(dateTimeItem); addCommand(BACK_CMD); setCommandListener(this); } void setDate() { dateTimeItem.setDate(new java.util.Date()); } public void commandAction(Command c, Displayable s) { if (s instanceof Form) { Form obj = (Form) s; if (obj == this) { if (c == BACK_CMD) { display.setCurrent(setMenu); } } } } } class SetTicker extends Form implements CommandListener { ChoiceGroup cg; SetTicker() { super("\u30c6\u30ed\u30c3\u30d7\u8a2d\u5b9a"); cg = new ChoiceGroup("Choice Group", Choice.MULTIPLE); cg.append("\u304a\u6c17\u306b\u5165\u308a", null); cg.append("\u30dd\u30c3\u30d7", null); cg.append("\u30ed\u30c3\u30af", null); cg.append("\u30af\u30e9\u30b7\u30c3\u30af", null); cg.append("\u30b8\u30e3\u30ba", null); cg.append("\u305d\u306e\u4ed6", null); append(cg); cg.setSelectedIndex(3, true); addCommand(BACK_CMD); addCommand(SAVE_CMD); setCommandListener(this); } boolean[] ret = new boolean[6]; public void commandAction(Command c, Displayable s) { if (c == SAVE_CMD) { cg.getSelectedFlags(ret); String str = band.toTickerString(ret); if (str != null) { ticker.setString(str); } display.setCurrent(savedMsg, setMenu); } else if (c == BACK_CMD) { display.setCurrent(setMenu); } } } class Update extends Form implements CommandListener { Timer timerService = new Timer(); ChoiceGroup cg; Update() { super("\u9593\u9694"); cg = new ChoiceGroup("Choice Group", Choice.EXCLUSIVE); cg.append("\u9023\u7d9a", null); cg.append("15 \u5206", null); cg.append("30 \u5206", null); cg.append("1 \u6642\u9593", null); cg.append("3 \u6642\u9593", null); append(cg); addCommand(BACK_CMD); addCommand(SAVE_CMD); setCommandListener(this); } public void commandAction(Command c, Displayable s) { if (c == SAVE_CMD) { if (updateAlert.hasDataToUpdate()) { int idx = cg.getSelectedIndex(); TimerTask timerClient = new TimerTask() { public final void run() { updateAlert.show(); } }; switch (idx) { case 0: timerService.schedule(timerClient, 3000); break; case 1: timerService.schedule(timerClient, 3000); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -