📄 funmodalpopup.java
字号:
/*
* Copyright (C) 2006-2007 Funambol
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.funambol.mailclient.ui.view;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
/**
* Generic Popup Modal UI to get the confirmation by the user in typical
* scenario using Confirm/Cancel commands
*/
public class FunModalPopup extends Form implements CommandListener {
private PopupAction action;
private Command OkCommand;
private Command KoCommand;
/**
* Creates a new instance of FunModalPopup
* @param title Title of the Popup Form shown to the user
* @param question Question prompted to the user
* @param action Action passed to be executed catching the user action
* on commands
*/
public FunModalPopup(String title, String question, PopupAction action) {
super(title);
this.action = action;
OkCommand = new Command("Yes", Command.OK, 0);
KoCommand = new Command("No", Command.CANCEL, 0);
addCommand(OkCommand);
addCommand(KoCommand);
append(question);
setCommandListener(this);
}
/**
* Handle user action on commands
*/
public void commandAction(Command command, Displayable displayable) {
if (command == OkCommand) {
action.confirm();
} else if (command == KoCommand) {
action.cancel();
}
this.removeCommand(OkCommand);
this.removeCommand(KoCommand);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -