📄 item.html
字号:
an operation on a hyperlink, such as loading the referent of the link or adding the link to the user's set of bookmarks.</p> <p>Setting the appearance mode of an <code>Item</code> to be other than <code>PLAIN</code> may affect its minimum, preferred, and maximum sizes, as well as the way it is laid out. For example, a <code>StringItem</code> with an appearance mode of <code>BUTTON</code> should not be wrapped across rows. (However, a <code>StringItem</code> with an appearance mode of <code>HYPERLINK</code> should be wrapped the same way as if its appearance mode is <code>PLAIN</code>.)</p> <p>A <code>StringItem</code> or <code>ImageItem</code> in <code>BUTTON</code> mode can be used to create a button-based user interface. This can easily lead to applications that are inconvenient to use. For example, in a traversal-based system, users must navigate to a button before they can invoke any commands on it. If buttons are spread across a long <code>Form</code>, users may be required to perform a considerable amount of navigation in order to discover all the available commands. Furthermore, invoking a command from a button at the other end of the <code>Form</code> can be quite cumbersome. Traversal-based systems often provide a means of invoking commands from anywhere (such as from a menu), without the need to traverse to a particular item. Instead of adding a command to a button and placing that button into a <code>Form</code>, it would often be more appropriate and convenient for users if that command were added directly to the <code>Form</code>. Buttons should be used only in cases where direct user interaction with the item's string or image contents is essential to the user's understanding of the commands that can be invoked from that item.</p> <h3>Default State</h3> <p>Unless otherwise specified by a subclass, the default state of newly created <code>Items</code> is as follows:</p> <ul> <li>the <code>Item</code> is not contained within ("owned by") any container;</li> <li>there are no <code>Commands</code> present;</li> <li>the default <code>Command</code> is <code>null</code>;</li> <li>the <code>ItemCommandListener</code> is <code>null</code>;</li> <li>the layout directive value is <code>LAYOUT_DEFAULT</code>; and</li> <li>both the preferred width and preferred height are unlocked.</li> </ul>
<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>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#BUTTON">BUTTON</A></B></CODE>
<BR>
An appearance mode value indicating that the <code>Item</code> is to appear as a button.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#HYPERLINK">HYPERLINK</A></B></CODE>
<BR>
An appearance mode value indicating that the <code>Item</code> is to appear as a hyperlink.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_2">LAYOUT_2</A></B></CODE>
<BR>
A layout directive indicating that new MIDP 2.0 layout rules are in effect for this <code>Item</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_BOTTOM">LAYOUT_BOTTOM</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should have a bottom-aligned layout.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_CENTER">LAYOUT_CENTER</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should have a horizontally centered layout.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_DEFAULT">LAYOUT_DEFAULT</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should follow the default layout policy of its container.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_EXPAND">LAYOUT_EXPAND</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item's</code> width may be increased to fill available space.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_LEFT">LAYOUT_LEFT</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should have a left-aligned layout.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_NEWLINE_AFTER">LAYOUT_NEWLINE_AFTER</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should the last on its line or row, and that the next <code>Item</code> (if any) in the container should be placed on a new line or row.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_NEWLINE_BEFORE">LAYOUT_NEWLINE_BEFORE</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should be placed at the beginning of a new line or row.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_RIGHT">LAYOUT_RIGHT</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should have a right-aligned layout.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_SHRINK">LAYOUT_SHRINK</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item's</code> width may be reduced to its minimum width.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_TOP">LAYOUT_TOP</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should have a top-aligned layout.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_VCENTER">LAYOUT_VCENTER</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item</code> should have a vertically centered layout.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_VEXPAND">LAYOUT_VEXPAND</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item's</code> height may be increased to fill available space.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#LAYOUT_VSHRINK">LAYOUT_VSHRINK</A></B></CODE>
<BR>
A layout directive indicating that this <code>Item's</code> height may be reduced to its minimum height.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Item.html#PLAIN">PLAIN</A></B></CODE>
<BR>
An appearance mode value indicating that the <code>Item</code> is to have a normal appearance.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== 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/Item.html#addCommand(javax.microedition.lcdui.Command)">addCommand</A></B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</CODE>
<BR>
Adds a context sensitive <code>Command</code> to the item.</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/Item.html#getLabel()">getLabel</A></B>()</CODE>
<BR>
Gets the label of this <code>Item</code> object.</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/Item.html#getLayout()">getLayout</A></B>()</CODE>
<BR>
Gets the layout directives used for placing the item.</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/Item.html#getMinimumHeight()">getMinimumHeight</A></B>()</CODE>
<BR>
Gets the minimum height for this <code>Item</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/Item.html#getMinimumWidth()">getMinimumWidth</A></B>()</CODE>
<BR>
Gets the minimum width for this <code>Item</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/Item.html#getPreferredHeight()">getPreferredHeight</A></B>()</CODE>
<BR>
Gets the preferred height of this <code>Item</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/Item.html#getPreferredWidth()">getPreferredWidth</A></B>()</CODE>
<BR>
Gets the preferred width of this <code>Item</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/Item.html#notifyStateChanged()">notifyStateChanged</A></B>()</CODE>
<BR>
Causes this <code>Item's</code> containing <code>Form</code> to notify the <code>Item's</code> <A HREF="../../../javax/microedition/lcdui/ItemStateListener.html"><CODE>ItemStateListener</CODE></A>.</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/Item.html#removeCommand(javax.microedition.lcdui.Command)">removeCommand</A></B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</CODE>
<BR>
Removes the context sensitive command from item.</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/Item.html#setDefaultCommand(javax.microedition.lcdui.Command)">setDefaultCommand</A></B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</CODE>
<BR>
Sets default <code>Command</code> for this <code>Item</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/Item.html#setItemCommandListener(javax.microedition.lcdui.ItemCommandListener)">setItemCommandListener</A></B>(<A HREF="../../../javax/microedition/lcdui/ItemCommandListener.html">ItemCommandListener</A> l)</CODE>
<BR>
Sets a listener for <code>Commands</code> to this <code>Item</code>, replacing any previous <code>ItemCommandListener</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/Item.html#setLabel(java.lang.String)">setLabel</A></B>(<A HREF="../../../java/lang/String.html">String</A> label)</CODE>
<BR>
Sets the label of the <code>Item</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/Item.html#setLayout(int)">setLayout</A></B>(int layout)</CODE>
<BR>
Sets the layout directives for this item.</TD>
</TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -