当前位置: 首页>>代码示例>>Java>>正文


Java TextField类代码示例

本文整理汇总了Java中javax.microedition.lcdui.TextField的典型用法代码示例。如果您正苦于以下问题:Java TextField类的具体用法?Java TextField怎么用?Java TextField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextField类属于javax.microedition.lcdui包,在下文中一共展示了TextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setConstraints

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public void setConstraints(final int constraints) {
	activity.post(new Runnable() {
		public void run() {
               if ((constraints & TextField.CONSTRAINT_MASK) == TextField.URL) {
                   editView.setSingleLine(true);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.NUMERIC) {
                   editView.setSingleLine(true);
                   editView.setInputType(InputType.TYPE_CLASS_NUMBER);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.DECIMAL) {
                   editView.setSingleLine(true);
                   editView.setInputType(
                           InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.PHONENUMBER) {
                   editView.setSingleLine(true);
                   editView.setInputType(InputType.TYPE_CLASS_PHONE);
               }
               if ((constraints & TextField.PASSWORD) != 0) {
                   editView.setTransformationMethod(PasswordTransformationMethod.getInstance());
                   editView.setTypeface(Typeface.MONOSPACE);
               }
		}
	});
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:24,代码来源:AndroidTextFieldUI.java

示例2: createView

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public void createView() {

        //#if javarosa.usepolishlocalisation
        //setHint(Locale.get("hint.TypeOrScan"));
        //#else
        setHint("Type in your answer");
        //#endif

        //#style textBox
         tf = new TextField("", "", 200, TextField.ANY);
         if(qDef.instanceNode.required)
                tf.setLabel("*"+((QuestionDef)qDef.element).getLongText()); //visual symbol for required
                else
                    tf.setLabel(((QuestionDef)qDef.element).getLongText());
        this.append(tf);
        this.addNavigationButtons();
        if (((QuestionDef)qDef.element).getHelpText()!=null){
            setHint(((QuestionDef)qDef.element).getHelpText());
        }

    }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:22,代码来源:BarcodeQuestionWidget.java

示例3: SendGui

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
/**
 *
 * Constructor
 */
public SendGui(){
	super("Write a message");

	// Creating  the Commands
	sendTextPackage = new Command("Send",Command.ITEM,1);
	displayLog = new Command("View log",Command.ITEM,4);
	exit = new Command("Exit", Command.EXIT,0);
          search = new Command("Search", Command.OK, 1);
          input = new TextField("Message","",200,TextField.ANY);

	// The ChoiceGroup containing the connected Nodes
	connectedNodes = new ChoiceGroup("Choose recipients", Choice.MULTIPLE);

	// Adding the elements
          addCommand(sendTextPackage);
	addCommand(displayLog);
	addCommand(exit);
          addCommand (search)  ;
          append(connectedNodes);
	append(input);
}
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:26,代码来源:Peer2Messenger.java

示例4: isValidString

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
/**
 * Check is this is a valid string given the constraints
 *
 * @param dca string to check
 * @param constraints the constraints 
 * @return true if this is a valid string
 */
public static boolean isValidString(DynamicCharacterArray dca, 
                                    int constraints) { 

    if (dca.length() == 0) {
        return true;
    }

    switch (constraints & TextField.CONSTRAINT_MASK) {
        case TextField.ANY:         return true;
        case TextField.DECIMAL:     return checkDecimal(dca.toString());
        case TextField.EMAILADDR:   return true;
        case TextField.NUMERIC:     return checkNumeric(dca.toString());
        case TextField.PHONENUMBER: return checkPhoneNumber(dca.toString());
        case TextField.URL:         return true;
    }
    return false;
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:25,代码来源:TextPolicy.java

示例5: handleGuiAction

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
protected void handleGuiAction(GuiButton guiButton) {
    if (!guiButton.enabled) {
        return;
    }

    if (guiButton.getId() == 0) {
        selectWorld(selectedWorld);
    } else if (guiButton.getId() == 1) {
        cc.displayGuiScreen(new GuiNewWorld(this, parentScreen));
        guiButton.setEnabled(getElementsList().size() < maxWorlds);
    } else if (guiButton.getId() == 2) {
        cc.displayGuiScreen(new GuiYesNo(this, cc.langBundle.getText("GuiSelectWorld.deleteWorld.confirmationText")));
    } else if (guiButton.getId() == 3) {
        backToParentScreen();
    } else if (guiButton.getId() == 4) {
        cc.displayGuiScreen(new GuiTextBox(this, selectedWorld.getWorldName(), TextField.ANY, 64));
    }
}
 
开发者ID:queader,项目名称:Comcraft,代码行数:19,代码来源:GuiSelectWorld.java

示例6: RecordStoreForm

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public RecordStoreForm() {
super("RecordStore");
addCommand(loadCommand);
addCommand(storeCommand);
addCommand(deleteCommand);
addCommand(listCommand);

textFiled = new TextField("Enter data", "", 128, TextField.ANY);
append(textFiled);

stringItem = new StringItem("Loaded data", "n/a");
append(stringItem);

messageItem = new StringItem("Info:", "Use menu to load and store data");
append(messageItem);
  }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:RecordStoreForm.java

示例7: HTTPPanel

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public HTTPPanel() {
	super("HTTP Connection");
	
	String host = SimpleDemoMIDlet.instance.getAppProperty("microemu.accessible.host");
	if (host == null) {
		demoLocation = "http://www.microemu.org/test/";
	} else {
		demoLocation = "http://" + host + "/test/";
	}
	
	append(url = new TextField("URL:", demoLocation, 128, TextField.URL));
	append(message = new StringItem("Message:", null));
	append(status = new StringItem("Status:", null));
	
	addCommand(goCommand);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:HTTPPanel.java

示例8: EditBox

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public EditBox(VirtualList parentList, String caption, String text, TextInput ti, int boxType) {
    this.ti = ti;
    this.caption = caption;
    this.parentList = parentList;
    t = new ExTextBox(parentList, text, caption, false);
    t.textbox.setConstraints(boxType);
    t.textbox.addCommand(cmdOk);
    if (ti.id != null) {
        loadRecentList();
        if (recentList.size() > 0) {
            t.textbox.addCommand(cmdRecent);
        }
    }
    t.textbox.addCommand(cmdCancel);
    if (Config.getInstance().capsState) {
        t.textbox.setConstraints(TextField.INITIAL_CAPS_SENTENCE);
    }
    t.show(this);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:20,代码来源:EditBox.java

示例9: setInputMethodListener

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public void setInputMethodListener(InputMethodListener l)
{
	inputMethodListener = l;
       switch (l.getConstraints() & TextField.CONSTRAINT_MASK) {
        case TextField.ANY :
        case TextField.EMAILADDR :
        case TextField.URL :
            setInputMode(INPUT_ABC_LOWER);
            break;
        case TextField.NUMERIC :
        case TextField.PHONENUMBER :
        case TextField.DECIMAL :
            setInputMode(INPUT_123);
            break;
    }
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:17,代码来源:InputMethod.java

示例10: setConstraints

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public void setConstraints(final int constraints) {
	activity.post(new Runnable() {
		public void run() {
               if ((constraints & TextField.CONSTRAINT_MASK) == TextField.URL) {
                   editView.setSingleLine(true);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.NUMERIC) {
                   editView.setSingleLine(true);
                   editView.setInputType(InputType.TYPE_CLASS_NUMBER);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.DECIMAL) {
                   editView.setSingleLine(true);
                   editView.setInputType(
                           InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.PHONENUMBER) {
                   editView.setSingleLine(true);
                   editView.setInputType(InputType.TYPE_CLASS_PHONE);
               }
               if ((constraints & TextField.PASSWORD) != 0) {
                   editView.setTransformationMethod(PasswordTransformationMethod.getInstance());
                   editView.setTypeface(Typeface.MONOSPACE);
               }
               if ((constraints & TextField.INITIAL_CAPS_SENTENCE) != 0) {
                   editView.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
               }
		}
	});
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:27,代码来源:AndroidTextFieldUI.java

示例11: SubmitForm

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
/**
 * Constructor ErrorPrompt. 
 *
 * @param  parent  ...
 */
public SubmitForm(MIDlet parent, LSClient client, ErrorPrompt errorPrompt) {
    this.errorPrompt = errorPrompt; 
    this.client = client;
    
    messageListener = new SentListener();
    
    close = new Command("Back", Command.STOP, 2);
    send = new Command("Send", Command.OK, 1);
    
    sendForm = new Form("RoundTrip Form");
    
    text = new TextField("Write message","",100,TextField.ANY);
    sendForm.append(text);

    field = new ChoiceGroup("Select Item",Choice.EXCLUSIVE,new String[]{"1","2","3","4","5"},null);
    sendForm.append(field);
    
    sendForm.addCommand(close);
    sendForm.addCommand(send);
    

    sendForm.setCommandListener(this);
    midlet = parent;
    reset();
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-client-midlet,代码行数:31,代码来源:SubmitForm.java

示例12: setupFields

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
private void setupFields() {
	titleField = new TextField("Title", "", 32, TextField.ANY);
	contentField = new TextField("Content", "", 128, TextField.ANY);
	dateField = new DateField("Date", DateField.DATE);
	categoryField = new ChoiceGroup("Category", Choice.EXCLUSIVE, Category.elements, null);
	priorityField = new Gauge("Priority", true, 10, 5);
	
	this.append(titleField);
	this.append(contentField);
	this.append(dateField);
	this.append(categoryField);
	this.append(priorityField);
}
 
开发者ID:NotesTeam,项目名称:TaskBook-J2ME,代码行数:14,代码来源:AddNoteForm.java

示例13: initTextFied

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
private TextField initTextFied(String title) {
    final String tfTitle = (title == null) ? "Enter text:" : title;
    TextField tf = new TextField(tfTitle, "", 8192, TextField.ANY);
    tf.addCommand(CMDTEXT_OK);
    tf.setDefaultCommand(CMDTEXT_OK);
    tf.setItemCommandListener(this);
    return tf;
}
 
开发者ID:aNNiMON,项目名称:JECP,代码行数:9,代码来源:ConsoleApplication.java

示例14: read

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
public String read(String title) {
    if (title != null) {
        println(title);
    }
    TextField tf = initTextFied(title);
    form.append(tf);
    synchronized (this) {
        try {
            wait();
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
    }
    return tf.getString();
}
 
开发者ID:aNNiMON,项目名称:JECP,代码行数:16,代码来源:ConsoleApplication.java

示例15: createLoggingTextBox

import javax.microedition.lcdui.TextField; //导入依赖的package包/类
private TextBox createLoggingTextBox() {
    TextBox box = new TextBox(Localization.get("message.log"), null, 1000,
            TextField.UNEDITABLE);
    box.addCommand(FormTransportCommands.CMD_BACK);
    return box;

}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:8,代码来源:FormTransportViews.java


注:本文中的javax.microedition.lcdui.TextField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。