⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formfiller.java.svn-base

📁 j2me mobile application for upload file to server.
💻 SVN-BASE
字号:
package org.celllife.clforms;import javax.microedition.lcdui.Alert;import javax.microedition.lcdui.AlertType;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Display;import javax.microedition.lcdui.Displayable;import javax.microedition.lcdui.Form;import javax.microedition.lcdui.List;import javax.microedition.lcdui.TextField;import javax.microedition.midlet.MIDlet;import org.celllife.clforms.task.BrowseTask;import org.celllife.clforms.task.IOTask;import de.enough.polish.util.Locale;public class FormFiller extends MIDlet implements CommandListener {	// vars	private Display display;	private Command selectCommand;	private TextField urlField;	private Command loadCommand;	private static Command exitCommand;	public FormFiller() {		exitCommand = new Command(Locale.get("menu.exit"), Command.EXIT, 1); //$NON-NLS-1$		selectCommand = new Command(Locale.get("menu.load"), Command.ITEM, 1); //$NON-NLS-1$		loadCommand = new Command(Locale.get("menu.load"), Command.OK, 1); //$NON-NLS-1$		display = Display.getDisplay(this);		MVCComponent.display = display;		// Check that the File Connection Optional Package is there		String v = System				.getProperty("microedition.io.file.FileConnection.version");		if (v != null) {			Constants.FILE_CONNECTION = true;		} else {			Constants.FILE_CONNECTION = false;		}		XFormScreen.m = this;	}	protected void startApp() {		startScreen();	}	private void startScreen() {		String[] modes = {Locale.get("mode.online"), Locale.get("mode.offline")};		List mode = new List("Mode", List.IMPLICIT, modes, null);		mode.setSelectCommand(selectCommand);		mode.addCommand(exitCommand);		mode.setCommandListener(this);		display.setCurrent(mode);	}	protected void pauseApp() {	}	protected void destroyApp(boolean bool) {	}	public void commandAction(Command cmd, Displayable disp) {		if (cmd == exitCommand) {			destroyApp(false);			notifyDestroyed();		} else if (cmd == selectCommand) {			List curr = (List) disp;			String item = curr.getString(curr.getSelectedIndex());			if (item.equals(Locale.get("mode.offline"))) {				if (!Constants.FILE_CONNECTION) {					Alert a = new Alert(							"Error", Locale.get("error.noFileConnection"), null, AlertType.ERROR); //$NON-NLS-1$					a.setTimeout(Alert.FOREVER);					display.setCurrent(a);				} else {					Constants.MODE = Constants.OFFLINE;					BrowseTask b = new BrowseTask(FileBrowser.MEGA_ROOT, display);					b.go();				}			} else {				Constants.MODE = Constants.ONLINE;				showURLField();			}		} else if (cmd == loadCommand) {			IOTask t = new IOTask(urlField.getString(), display, true);			t.go();		}	}	/**	 * 	 */	private void showURLField() {		Form f = new Form("URL");		urlField = new TextField("URL: ", "http://mobile.cell-life.org/test_form.xhtml", 100, TextField.ANY);		f.append(urlField);		f.addCommand(exitCommand);		f.addCommand(loadCommand);		f.setCommandListener(this);		display.setCurrent(f);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -