📄 list.html
字号:
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the new title, or <code>null</code> for no title<DT><B>Since: </B><DD>MIDP 2.0</DD>
<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Displayable.html#getTitle()"><CODE>Displayable.getTitle()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="size()"><!-- --></A><H3>
size</H3>
<PRE>
public int <B>size</B>()</PRE>
<DL>
<DD>Gets the number of elements in the <code>List</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#size()">size</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the number of elements in the <code>List</code></DL>
</DD>
</DL>
<HR>
<A NAME="getString(int)"><!-- --></A><H3>
getString</H3>
<PRE>
public <A HREF="../../../java/lang/String.html">String</A> <B>getString</B>(int elementNum)</PRE>
<DL>
<DD>Gets the <code>String</code> part of the element referenced by <code>elementNum</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#getString(int)">getString</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - the index of the element to be queried<DT><B>Returns:</B><DD>the string part of the element<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/List.html#getImage(int)"><CODE>getImage(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getImage(int)"><!-- --></A><H3>
getImage</H3>
<PRE>
public <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> <B>getImage</B>(int elementNum)</PRE>
<DL>
<DD>Gets the <code>Image</code> part of the element referenced by <code>elementNum</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#getImage(int)">getImage</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - the number of the element to be queried<DT><B>Returns:</B><DD>the image part of the element, or <code>null</code> if there is no image<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/List.html#getString(int)"><CODE>getString(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="append(java.lang.String, javax.microedition.lcdui.Image)"><!-- --></A><H3>
append</H3>
<PRE>
public int <B>append</B>(<A HREF="../../../java/lang/String.html">String</A> stringPart, <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> imagePart)</PRE>
<DL>
<DD>Appends an element to the <code>List</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#append(java.lang.String, javax.microedition.lcdui.Image)">append</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>stringPart</CODE> - the string part of the element to be added<DD><CODE>imagePart</CODE> - the image part of the element to be added, or <code>null</code> if there is no image part<DT><B>Returns:</B><DD>the assigned index of the element<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>stringPart</code> is <code>null</code></DL>
</DD>
</DL>
<HR>
<A NAME="insert(int, java.lang.String, javax.microedition.lcdui.Image)"><!-- --></A><H3>
insert</H3>
<PRE>
public void <B>insert</B>(int elementNum, <A HREF="../../../java/lang/String.html">String</A> stringPart, <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> imagePart)</PRE>
<DL>
<DD>Inserts an element into the <code>List</code> just prior to the element specified.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#insert(int, java.lang.String, javax.microedition.lcdui.Image)">insert</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - the index of the element where insertion is to occur<DD><CODE>stringPart</CODE> - the string part of the element to be inserted<DD><CODE>imagePart</CODE> - the image part of the element to be inserted, or <code>null</code> if there is no image part<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>stringPart</code> is <code>null</code></DL>
</DD>
</DL>
<HR>
<A NAME="delete(int)"><!-- --></A><H3>
delete</H3>
<PRE>
public void <B>delete</B>(int elementNum)</PRE>
<DL>
<DD>Deletes the element referenced by <code>elementNum</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#delete(int)">delete</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - the index of the element to be deleted<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid</DL>
</DD>
</DL>
<HR>
<A NAME="deleteAll()"><!-- --></A><H3>
deleteAll</H3>
<PRE>
public void <B>deleteAll</B>()</PRE>
<DL>
<DD>Deletes all elements from this List.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#deleteAll()">deleteAll</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="set(int, java.lang.String, javax.microedition.lcdui.Image)"><!-- --></A><H3>
set</H3>
<PRE>
public void <B>set</B>(int elementNum, <A HREF="../../../java/lang/String.html">String</A> stringPart, <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> imagePart)</PRE>
<DL>
<DD>Sets the <code>String</code> and <code>Image</code> parts of the element referenced by <code>elementNum</code>, replacing the previous contents of the element.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#set(int, java.lang.String, javax.microedition.lcdui.Image)">set</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - the index of the element to be set<DD><CODE>stringPart</CODE> - the string part of the new element<DD><CODE>imagePart</CODE> - the image part of the element, or <code>null</code> if there is no image part<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>stringPart</code> is <code>null</code></DL>
</DD>
</DL>
<HR>
<A NAME="isSelected(int)"><!-- --></A><H3>
isSelected</H3>
<PRE>
public boolean <B>isSelected</B>(int elementNum)</PRE>
<DL>
<DD>Gets a boolean value indicating whether this element is selected.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#isSelected(int)">isSelected</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - index to element to be queried<DT><B>Returns:</B><DD>selection state of the element<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid</DL>
</DD>
</DL>
<HR>
<A NAME="getSelectedIndex()"><!-- --></A><H3>
getSelectedIndex</H3>
<PRE>
public int <B>getSelectedIndex</B>()</PRE>
<DL>
<DD>Returns the index number of an element in the <code>List</code> that is selected.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#getSelectedIndex()">getSelectedIndex</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>index of selected element, or <code>-1</code> if none<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/List.html#setSelectedIndex(int, boolean)"><CODE>setSelectedIndex(int, boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getSelectedFlags(boolean[])"><!-- --></A><H3>
getSelectedFlags</H3>
<PRE>
public int <B>getSelectedFlags</B>(boolean[] selectedArray_return)</PRE>
<DL>
<DD>Queries the state of a <code>List</code> and returns the state of all elements in the boolean array <code>selectedArray_return</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#getSelectedFlags(boolean[])">getSelectedFlags</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>selectedArray_return</CODE> - array to contain the results<DT><B>Returns:</B><DD>the number of selected elements in the <code>Choice</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>selectedArray_return</code> is shorter than the size of the List<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>selectedArray_return</code> is <code>null</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/List.html#setSelectedFlags(boolean[])"><CODE>setSelectedFlags(boolean[])</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setSelectedIndex(int, boolean)"><!-- --></A><H3>
setSelectedIndex</H3>
<PRE>
public void <B>setSelectedIndex</B>(int elementNum, boolean selected)</PRE>
<DL>
<DD>Sets the selected state of an element.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#setSelectedIndex(int, boolean)">setSelectedIndex</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elementNum</CODE> - the index of the element, starting from zero<DD><CODE>selected</CODE> - the state of the element, where <code>true</code> means selected and <code>false</code> means not selected<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if <code>elementNum</code> is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/List.html#getSelectedIndex()"><CODE>getSelectedIndex()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setSelectedFlags(boolean[])"><!-- --></A><H3>
setSelectedFlags</H3>
<PRE>
public void <B>setSelectedFlags</B>(boolean[] selectedArray)</PRE>
<DL>
<DD>Sets the selected state of all elements of the <code>List</code>.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Choice.html#setSelectedFlags(boolean[])">setSelectedFlags</A></CODE> in interface <CODE><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>selectedArray</CODE> - an array in which the method collect the selection status<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>selectedArray</code> is shorter than the size of the <code>List</code><DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>selectedArray</code> is <code>null</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/List.html#getSelectedFlags(boolean[])"><CODE>getSelectedFlags(boolean[])</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="removeCommand(javax.microedition.lcdui.Command)"><!-- --></A><H3>
removeCommand</H3>
<PRE>
public void <B>removeCommand</B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</PRE>
<DL>
<DD>The same as <A HREF="../../../javax/microedition/lcdui/Displayable.html#removeCommand(javax.microedition.lcdui.Command)"><CODE>Displayable.removeCommand</CODE></A> but with the following additional semantics. <p>If the command to be removed happens to be the select command, the <code>List</code> is set to have no select command, and the command is removed from the <code>List</code>.</p> <p>The following code: </P> <TABLE BORDER="2"> <TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -