Today I bought 2.5 lbs of coffee beans from Starbucks. It's a little expensive. It's worth 599 oceans. I just made a cup of coffee and smoked some cigarettes. Although today is Saturday, it is estimated that we will not be able to see much today. We will go to the company to work overtime tomorrow, so we still need to take a break early today... Think about the past few weeks. In soho, every night is my work time, during the day .. Hey, go to bed... That's so happy... Good days no longer...
Haha, TextBox, it seems that you know what to do when you look at the name, the input box in HTML. Oh, it should be similar. Write one (there is another object with the same usage method as TextBox: TextField, haha, it feels like this is only TextArea in HTML ^_^)
Test procedure first:
Package com. graph;
/**
* @ Author You Li
*
* CopyRight (C) 2005 www.iguess.com.cn
*/
Import javax. microedition. midlet .*;
Import javax. microedition. lcdui .*;
Public class TextBoxTest extends MIDlet implements CommandListener {
Private Display display;
Command commit;
Public TextBoxTest (){
Display = Display. getDisplay (this );
// TODO automatically generates the constructor stub
}
Protected void startApp () throws MIDletStateChangeException {
// TODO automatically generates method stubs
Commit = new Command ("Submit", Command. SCREEN, 1 );
TextBox tb = new TextBox ("input box", "default", 12, TextField. ANY );
Tb. addCommand (commit );
Tb. setCommandListener (this );
Display. setCurrent (tb );
}
Protected void pauseApp (){
// TODO automatically generates method stubs
}
Protected void destroyApp (boolean arg0) throws MIDletStateChangeException {
// TODO automatically generates method stubs
}
Public void commandAction (Command c, Displayable s ){
TextBox tmp = (TextBox) s;
System. out. println (tmp. getString ());
}
}
The function of this program is to print the input content on the screen in the background. TextBox ("input box", "default", 12, TextField. ANY) is used to set the properties of the dialog box. I tested it today and read the document, mainly in the last two attributes. The number indicates the maximum number of characters acceptable to the input box, TextField. ANY-ANY character; TextField. EMAILADDR-Email address accepted; TextField. NUMERIC-only numbers are allowed. TextField. PASSWORD-enter the PASSWORD; TextField. PHONENUMBER-enter the phone number, that is, numbers, spaces, asterisks, and well numbers are acceptable. TextField. URL-Accept the input URL; TextField. CONSTRAINT_MASK-perform AND logical operations on the results returned by the getConstraints () method of TextBox, AND then obtain the current limitation settings. Of course, this parameter is not used when TextBox is created.