📄 list.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 List
</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/List.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/Item.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/lcdui/Screen.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="List.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <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 List</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.List</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B>List</B><DT>extends <A HREF="../../../javax/microedition/lcdui/Screen.html">Screen</A><DT>implements <A HREF="../../../javax/microedition/lcdui/Choice.html">Choice</A></DL>
<P>
A <code>Screen</code> containing list of choices. Most of its behavior is common with class <A HREF="../../../javax/microedition/lcdui/ChoiceGroup.html"><CODE>ChoiceGroup</CODE></A>, and their common API. The different <code>List</code> types in particular, are defined in interface <A HREF="../../../javax/microedition/lcdui/Choice.html"><CODE>Choice</CODE></A>. When a <code>List</code> is present on the display, the user can interact with it by selecting elements and possibly by traversing and scrolling among them. Traversing and scrolling operations do not cause application-visible events. The system notifies the application only when a <A HREF="../../../javax/microedition/lcdui/Command.html"><CODE>Command</CODE></A> is invoked by notifying its <A HREF="../../../javax/microedition/lcdui/CommandListener.html"><CODE>CommandListener</CODE></A>. The <code>List</code> class also supports a select command that may be invoked specially depending upon the capabilities of the device. <p>The notion of a <em>select</em> operation on a <code>List</code> element is central to the user's interaction with the <code>List</code>. On devices that have a dedicated hardware "select" or "go" key, the select operation is implemented with that key. Devices that do not have a dedicated key must provide another means to do the select operation, for example, using a soft key. The behavior of the select operation within the different types of lists is described in the following sections.</p> <p><code>List</code> objects may be created with <code>Choice</code> types of <A HREF="../../../javax/microedition/lcdui/Choice.html#EXCLUSIVE"><CODE>Choice.EXCLUSIVE</CODE></A>, <A HREF="../../../javax/microedition/lcdui/Choice.html#MULTIPLE"><CODE>Choice.MULTIPLE</CODE></A>, and <A HREF="../../../javax/microedition/lcdui/Choice.html#IMPLICIT"><CODE>Choice.IMPLICIT</CODE></A>. The <code>Choice</code> type <A HREF="../../../javax/microedition/lcdui/Choice.html#POPUP"><CODE>Choice.POPUP</CODE></A> is not allowed on <code>List</code> objects.</p> <h3>Selection in <code>EXCLUSIVE</code> and <code>MULTIPLE</code> Lists</h3> <p>The select operation is not associated with a <code>Command</code> object, so the application has no means of setting a label for it or being notified when the operation is performed. In <code>Lists</code> of type <code>EXCLUSIVE</code>, the select operation selects the target element and deselects the previously selected element. In <code>Lists</code> of type <code>MULTIPLE</code>, the select operation toggles the selected state of the target element, leaving the selected state of other elements unchanged. Devices that implement the select operation using a soft key will need to provide a label for it. The label should be something similar to "Select" for <code>Lists</code> of type <code>EXCLUSIVE</code>, and it should be something similar to "Mark" or "Unmark" for <code>Lists</code> of type <code>MULTIPLE</code>.</p> <h3>Selection in <code>IMPLICIT</code> Lists</h3> <p>The select operation is associated with a <code>Command</code> object referred to as the <em>select command</em>. When the user performs the select operation, the system will invoke the select command by notifying the <code>List's</code> <A HREF="../../../javax/microedition/lcdui/CommandListener.html"><CODE>CommandListener</CODE></A>. The default select command is the system-provided command <code>SELECT_COMMAND</code>. The select command may be modified by the application through use of the <A HREF="../../../javax/microedition/lcdui/List.html#setSelectCommand(javax.microedition.lcdui.Command)"><CODE>setSelectCommand</CODE></A> method. Devices that implement the select operation using a soft key will use the label from the select command. If the select command is <code>SELECT_COMMAND</code>, the device may choose to provide its own label instead of using the label attribute of <code>SELECT_COMMAND</code>. Applications should generally provide their own select command to replace <code>SELECT_COMMAND</code>. This allows applications to provide a meaningful label, instead of relying on the one provided by the system for <code>SELECT_COMMAND</code>. The implementation must <em>not</em> invoke the select command if there are no elements in the <code>List</code>, because if the <code>List</code> is empty the selection does not exist. In this case the implementation should remove or disable the select command if it would appear explicitly on a soft button or in a menu. Other commands can be invoked normally when the <code>List</code> is empty.</p> <h3>Use of <code>IMPLICIT</code> Lists</h3> <p> <code>IMPLICIT</code> <code>Lists</code> can be used to construct menus by providing operations as <code>List</code> elements. The application provides a <code>Command</code> that is used to select a <code>List</code> element and then defines this <code>Command</code> to be used as the select command. The application must also register a <code>CommandListener</code> that is called when the user selects or activates the <code>Command</code>:</p> <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> String[] elements = { ... }; //Menu items as List elements List menuList = new List("Menu", List.IMPLICIT, elements, null); Command selectCommand = new Command("Open", Command.ITEM, 1); menuList.setSelectCommand(selectCommand); menuList.setCommandListener(...); </code></pre> </TD> </TR> </TABLE> <p>The listener can query the <code>List</code> to determine which element is selected and then perform the corresponding action. Note that setting a command as the select command adds it to the <code>List</code> as a side effect.</p> <p> The select command should be considered as a <em>default operation</em> that takes place when a select key is pressed. For example, a <code>List</code> displaying email headers might have three operations: read, reply, and delete. Read is considered to be the default operation. </p> <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> List list = new List("Email", List.IMPLICIT, headers); readCommand = new Command("Read", Command.ITEM, 1); replyCommand = new Command("Reply", Command.ITEM, 2); deleteCommand = new Command("Delete", Command.ITEM, 3); list.setSelectCommand(readCommand); list.addCommand(replyCommand); list.addCommand(deleteCommand); list.setCommandListener(...); </code></pre> </TD> </TR> </TABLE> <p>On a device with a dedicated select key, pressing this key will invoke <code>readCommand</code>. On a device without a select key, the user is still able to invoke the read command, since it is also provided as an ordinary <code>Command</code>.</p> <p> It should be noted that this kind of default operation must be used carefully, and the usability of the resulting user interface must always kept in mind. The default operation should always be the most intuitive operation on a particular List. </p>
<P>
<DL>
<DT><B>Since: </B><DD>MIDP 1.0</DD>
</DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -