📄 textfield.html
字号:
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#getConstraints()">getConstraints</A></B>()</CODE>
<BR>
Gets the current input constraints of the <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#getMaxSize()">getMaxSize</A></B>()</CODE>
<BR>
Returns the maximum size (number of characters) that can be stored in this <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../java/lang/String.html">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#getString()">getString</A></B>()</CODE>
<BR>
Gets the contents of the <code>TextField</code> as a string value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#insert(char[], int, int, int)">insert</A></B>(char[] data, int offset, int length, int position)</CODE>
<BR>
Inserts a subrange of an array of characters into the contents of the <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#insert(java.lang.String, int)">insert</A></B>(<A HREF="../../../java/lang/String.html">String</A> src, int position)</CODE>
<BR>
Inserts a string into the contents of the <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#setChars(char[], int, int)">setChars</A></B>(char[] data, int offset, int length)</CODE>
<BR>
Sets the contents of the <code>TextField</code> from a character array, replacing the previous contents.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#setConstraints(int)">setConstraints</A></B>(int constraints)</CODE>
<BR>
Sets the input constraints of the <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#setInitialInputMode(java.lang.String)">setInitialInputMode</A></B>(<A HREF="../../../java/lang/String.html">String</A> characterSubset)</CODE>
<BR>
Sets a hint to the implementation as to the input mode that should be used when the user initiates editing of this <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#setMaxSize(int)">setMaxSize</A></B>(int maxSize)</CODE>
<BR>
Sets the maximum size (number of characters) that can be contained in this <code>TextField</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#setString(java.lang.String)">setString</A></B>(<A HREF="../../../java/lang/String.html">String</A> text)</CODE>
<BR>
Sets the contents of the <code>TextField</code> as a string value, replacing the previous contents.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextField.html#size()">size</A></B>()</CODE>
<BR>
Gets the number of characters that are currently stored in this <code>TextField</code>.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.lcdui.Item"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.microedition.lcdui.<A HREF="../../../javax/microedition/lcdui/Item.html">Item</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/lcdui/Item.html#addCommand(javax.microedition.lcdui.Command)">addCommand</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#getLabel()">getLabel</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#getLayout()">getLayout</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#getMinimumHeight()">getMinimumHeight</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#getMinimumWidth()">getMinimumWidth</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#getPreferredHeight()">getPreferredHeight</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#getPreferredWidth()">getPreferredWidth</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#notifyStateChanged()">notifyStateChanged</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#removeCommand(javax.microedition.lcdui.Command)">removeCommand</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#setDefaultCommand(javax.microedition.lcdui.Command)">setDefaultCommand</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#setItemCommandListener(javax.microedition.lcdui.ItemCommandListener)">setItemCommandListener</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#setLabel(java.lang.String)">setLabel</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#setLayout(int)">setLayout</A>, <A HREF="../../../javax/microedition/lcdui/Item.html#setPreferredSize(int, int)">setPreferredSize</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="ANY"><!-- --></A><H3>
ANY</H3>
<PRE>
public static final int <B>ANY</B></PRE>
<DL>
<DD>The user is allowed to enter any text. <A HREF="Form.html#linebreak">Line breaks</A> may be entered. <P>Constant <code>0</code> is assigned to <code>ANY</code>.</P></DL>
<HR>
<A NAME="EMAILADDR"><!-- --></A><H3>
EMAILADDR</H3>
<PRE>
public static final int <B>EMAILADDR</B></PRE>
<DL>
<DD>The user is allowed to enter an e-mail address. <P>Constant <code>1</code> is assigned to <code>EMAILADDR</code>.</P></DL>
<HR>
<A NAME="NUMERIC"><!-- --></A><H3>
NUMERIC</H3>
<PRE>
public static final int <B>NUMERIC</B></PRE>
<DL>
<DD>The user is allowed to enter only an integer value. The implementation must restrict the contents either to be empty or to consist of an optional minus sign followed by a string of one or more decimal numerals. Unless the value is empty, it will be successfully parsable using <A HREF="../../../java/lang/Integer.html#parseInt(java.lang.String)"><CODE>Integer.parseInt(String)</CODE></A>. <P>The minus sign consumes space in the text object. It is thus impossible to enter negative numbers into a text object whose maximum size is <code>1</code>.</P> <P>Constant <code>2</code> is assigned to <code>NUMERIC</code>.</P></DL>
<HR>
<A NAME="PHONENUMBER"><!-- --></A><H3>
PHONENUMBER</H3>
<PRE>
public static final int <B>PHONENUMBER</B></PRE>
<DL>
<DD>The user is allowed to enter a phone number. The phone number is a special case, since a phone-based implementation may be linked to the native phone dialing application. The implementation may automatically start a phone dialer application that is initialized so that pressing a single key would be enough to make a call. The call must not made automatically without requiring user's confirmation. Implementations may also provide a feature to look up the phone number in the device's phone or address database. <P>The exact set of characters allowed is specific to the device and to the device's network and may include non-numeric characters, such as a "+" prefix character.</P> <P>Some platforms may provide the capability to initiate voice calls using the <A HREF="../../../javax/microedition/midlet/MIDlet.html#platformRequest(java.lang.String)"><CODE>MIDlet.platformRequest</CODE></A> method.</P> <P>Constant <code>3</code> is assigned to <code>PHONENUMBER</code>.</P></DL>
<HR>
<A NAME="URL"><!-- --></A><H3>
URL</H3>
<PRE>
public static final int <B>URL</B></PRE>
<DL>
<DD>The user is allowed to enter a URL. <P>Constant <code>4</code> is assigned to <code>URL</code>.</P></DL>
<HR>
<A NAME="DECIMAL"><!-- --></A><H3>
DECIMAL</H3>
<PRE>
public static final int <B>DECIMAL</B></PRE>
<DL>
<DD>The user is allowed to enter numeric values with optional decimal fractions, for example "-123", "0.123", or ".5". <p>The implementation may display a period "." or a comma "," for the decimal fraction separator, depending on the conventions in use on the device. Similarly, the implementation may display other device-specific characters as part of a decimal string, such as spaces or commas for digit separators. However, the only characters allowed in the actual contents of the text object are period ".", minus sign "-", and the decimal digits.</p> <p>The actual contents of a <code>DECIMAL</code> text object may be empty. If the actual contents are not empty, they must conform to a subset of the syntax for a <code>FloatingPointLiteral</code> as defined by the <em>Java Language Specification</em>, section 3.10.2. This subset syntax is defined as follows: the actual contents must consist of an optional minus sign "-", followed by one or more whole-number decimal digits, followed by an optional fraction separator, followed by zero or more decimal fraction digits. The whole-number decimal digits may be omitted if the fraction separator and one or more decimal fraction digits are present.</p> <p>The syntax defined above is also enforced whenever the application attempts to set or modify the contents of the text object by calling a constructor or a method.</p> <p>Parsing this string value into a numeric value suitable for computation is the responsibility of the application. If the contents are not empty, the result can be parsed successfully by <code>Double.valueOf</code> and related methods if they are present in the runtime environment. </p> <p>The sign and the fraction separator consume space in the text object. Applications should account for this when assigning a maximum size for the text object.</p> <P>Constant <code>5</code> is assigned to <code>DECIMAL</code>.</P><DD><DL>
<DT><B>Since: </B><DD>MIDP 2.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="PASSWORD"><!-- --></A><H3>
PASSWORD</H3>
<PRE>
public static final int <B>PASSWORD</B></PRE>
<DL>
<DD>Indicates that the text entered is confidential data that should be obscured whenever possible. The contents may be visible while the user is entering data. However, the contents must never be divulged to the user. In particular, the existing contents must not be shown when the user edits the contents. The means by which the contents
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -