📄 textbox.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Sep 24 14:57:49 PDT 2003 -->
<TITLE>
MID Profile: Class TextBox
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/TextBox.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<strong>MID Profile</strong></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/lcdui/StringItem.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/lcdui/TextField.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="TextBox.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.lcdui</FONT>
<BR>
Class TextBox</H2>
<PRE>
<A HREF="../../../java/lang/Object.html">java.lang.Object</A>
|
+--<A HREF="../../../javax/microedition/lcdui/Displayable.html">javax.microedition.lcdui.Displayable</A>
|
+--<A HREF="../../../javax/microedition/lcdui/Screen.html">javax.microedition.lcdui.Screen</A>
|
+--<B>javax.microedition.lcdui.TextBox</B>
</PRE>
<HR>
<DL>
<DT>public class <B>TextBox</B><DT>extends <A HREF="../../../javax/microedition/lcdui/Screen.html">Screen</A></DL>
<P>
The <code>TextBox</code> class is a <code>Screen</code> that allows the user to enter and edit text. <p>A <code>TextBox</code> has a maximum size, which is the maximum number of characters that can be stored in the object at any time (its capacity). This limit is enforced when the <code>TextBox</code> instance is constructed, when the user is editing text within the <code>TextBox</code>, as well as when the application program calls methods on the <code>TextBox</code> that modify its contents. The maximum size is the maximum stored capacity and is unrelated to the number of characters that may be displayed at any given time. The number of characters displayed and their arrangement into rows and columns are determined by the device. </p> <p>The implementation may place a boundary on the maximum size, and the maximum size actually assigned may be smaller than the application had requested. The value actually assigned will be reflected in the value returned by <A HREF="../../../javax/microedition/lcdui/TextBox.html#getMaxSize()"><CODE>getMaxSize()</CODE></A>. A defensively-written application should compare this value to the maximum size requested and be prepared to handle cases where they differ.</p> <p>The text contained within a <code>TextBox</code> may be more than can be displayed at one time. If this is the case, the implementation will let the user scroll to view and edit any part of the text. This scrolling occurs transparently to the application. </p> <p>If the constraints are set to <A HREF="../../../javax/microedition/lcdui/TextField.html#ANY"><CODE>TextField.ANY</CODE></A> The text may contain <A HREF="Form.html#linebreak">line breaks</A>. The display of the text must break accordingly and the user must be able to enter line break characters. </p> <p><code>TextBox</code> has the concept of <em>input constraints</em> that is identical to <code>TextField</code>. The <code>constraints</code> parameters of methods within the <code>TextBox</code> class use constants defined in the <A HREF="../../../javax/microedition/lcdui/TextField.html"><CODE>TextField</CODE></A> class. See the description of <a href="TextField.html#constraints">input constraints</a> in the <code>TextField</code> class for the definition of these constants. <code>TextBox</code> also has the same notions as <code>TextField</code> of the <em>actual contents</em> and the <em>displayed contents</em>, described in the same section. </p> <p><code>TextBox</code> also has the concept of <em>input modes</em> that is identical to <code>TextField</code>. See the description of <a href="TextField.html#modes">input modes</a> in the <code>TextField</code> class for more details.
<P>
<DL>
<DT><B>Since: </B><DD>MIDP 1.0</DD>
</DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/TextBox.html#TextBox(java.lang.String, java.lang.String, int, int)">TextBox</A></B>(<A HREF="../../../java/lang/String.html">String</A> title, <A HREF="../../../java/lang/String.html">String</A> text, int maxSize, int constraints)</CODE>
<BR>
Creates a new <code>TextBox</code> object with the given title string, initial contents, maximum size in characters, and constraints.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></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/TextBox.html#delete(int, int)">delete</A></B>(int offset, int length)</CODE>
<BR>
Deletes characters from the <code>TextBox</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/TextBox.html#getCaretPosition()">getCaretPosition</A></B>()</CODE>
<BR>
Gets the current input position.</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/TextBox.html#getChars(char[])">getChars</A></B>(char[] data)</CODE>
<BR>
Copies the contents of the <code>TextBox</code> into a character array starting at index zero.</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/TextBox.html#getConstraints()">getConstraints</A></B>()</CODE>
<BR>
Gets the current input constraints of the <code>TextBox</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/TextBox.html#getMaxSize()">getMaxSize</A></B>()</CODE>
<BR>
Returns the maximum size (number of characters) that can be stored in this <code>TextBox</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/TextBox.html#getString()">getString</A></B>()</CODE>
<BR>
Gets the contents of the <code>TextBox</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/TextBox.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>TextBox</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/TextBox.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>TextBox</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/TextBox.html#setChars(char[], int, int)">setChars</A></B>(char[] data, int offset, int length)</CODE>
<BR>
Sets the contents of the <code>TextBox</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/TextBox.html#setConstraints(int)">setConstraints</A></B>(int constraints)</CODE>
<BR>
Sets the input constraints of the <code>TextBox</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -