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

📄 urlcodebox.java~

📁 KeePass for J2ME is a J2ME port of KeePass Password Safe, a free, open source, light-weight and easy
💻 JAVA~
字号:
package org.phoneid.keepassj2me;// PhoneID utilsimport org.phoneid.*;// Javaimport java.io.*;import javax.microedition.lcdui.*;import javax.microedition.midlet.*;public class PasswordBox implements CommandListener{    protected KeePassMIDlet midlet;    private boolean isReady = false;    private Displayable dspBACK;    private String result = null;    private Form form = null;    private TextField txtField = null;    private int mCommandType = 0;    /**     * title : title of entire window     * boxTitle : title of text enter field     * defaultValue : default value of text enter field     * maxLen : max length of text enter field     * midlet : parent MIDlet object     * returnToPrevScreen : return to previous screen when the task is done     * type : TextField.NUMERIC, TextField.PASSWORD, etc.     * thirdButton : put a string if you want to have the third button after OK and CANCEL     * comment : comment about third button     */        public PasswordBox(String title, String boxTitle, String defaultValue, int maxLen, KeePassMIDlet midlet, boolean returnToPrevScreen, int type, String thirdButton, String comment)    {	//System.out.println ("PasswordBox 1");		form = new Form(title);			this.midlet = midlet;	//System.out.println ("PasswordBox 2: " + defaultValue);	txtField = new TextField(boxTitle, defaultValue, maxLen, type);	//System.out.println ("PasswordBox 3");	form.append(txtField);	//System.out.println ("PasswordBox 4");	form.setCommandListener(this);	form.addCommand(new Command("OK", Command.OK, 1));	form.addCommand(new Command("Cancel", Command.CANCEL, 1));	if (thirdButton != null)	    form.addCommand(new Command(thirdButton, Command.ITEM, 1));	if (comment != null)	    form.append(comment);		// Previous Display	dspBACK = Display.getDisplay(midlet).getCurrent();	// Set Display	Display.getDisplay(midlet).setCurrent(form);			// wait for it to be done	waitForDone();			// Return the the previous display	if (returnToPrevScreen == true) 	    Display.getDisplay(midlet).setCurrent(dspBACK);    }    private void waitForDone()    {	try {	    while(!isReady) {		synchronized(this) {		    this.wait();		}	    }	} catch(Exception e) {	}    }    public void commandAction(Command cmd, Displayable dsp)    {	mCommandType = cmd.getCommandType();		if(cmd.getCommandType() == Command.OK ||	   cmd.getCommandType() == Command.CANCEL ||	   cmd.getCommandType() == Command.ITEM) {	    if(cmd.getCommandType() == Command.OK)		result = txtField.getString();	    else 		result = null;	    	    isReady = true;	    	    synchronized(this) {		this.notify();	    }				}    }    public String getResult() {	return result;    }    public int getCommandType() {	return mCommandType;    }}

⌨️ 快捷键说明

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