📄 stringitem.html
字号:
</TABLE><A NAME="StringItem(java.lang.String, java.lang.String)"><!-- --></A><H3>StringItem</H3><PRE>public <B>StringItem</B>(String label, String text)</PRE><DL><DD>Creates a new <code>StringItem</code> object. Calling this constructor is equivalent to calling <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> StringItem(label, text, PLAIN); </code></pre> </TD> </TR> </TABLE><DD><DL><DT><B>Parameters:</B><DD><CODE>label</CODE> - the <code>Item</code> label<DD><CODE>text</CODE> - the text contents<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/StringItem.html#StringItem(java.lang.String, java.lang.String, int)"><CODE>StringItem(String, String, int)</CODE></A></DL></DD></DL><HR><A NAME="StringItem(java.lang.String, java.lang.String, int)"><!-- --></A><H3>StringItem</H3><PRE>public <B>StringItem</B>(String label, String text, int appearanceMode)</PRE><DL><DD>Creates a new <code>StringItem</code> object with the given label, textual content, and appearance mode. Either label or text may be present or <code>null</code>. <p>The <code>appearanceMode</code> parameter (see <a href="Item.html#appearance">Appearance Modes</a>) is a hint to the platform of the application's intended use for this <code>StringItem</code>. To provide hyperlink- or button-like behavior, the application should associate a default <code>Command</code> with this <code>StringItem</code> and add an <code>ItemCommandListener</code> to this <code>StringItem</code>. <p>Here is an example showing the use of a <code>StringItem</code> as a button: </p> <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> StringItem strItem = new StringItem("Default: ", "Set", Item.BUTTON); strItem.setDefaultCommand( new Command("Set", Command.ITEM, 1); // icl is ItemCommandListener strItem.setItemCommandListener(icl); </code></pre> </TD> </TR> </TABLE><DD><DL><DT><B>Parameters:</B><DD><CODE>label</CODE> - the <code>StringItem's</code> label, or <code>null</code> if no label<DD><CODE>text</CODE> - the <code>StringItem's</code> text contents, or <code>null</code> if the contents are initially empty<DD><CODE>appearanceMode</CODE> - the appearance mode of the <code>StringItem</code>, one of <A HREF="../../../javax/microedition/lcdui/Item.html#PLAIN"><CODE>Item.PLAIN</CODE></A>, <A HREF="../../../javax/microedition/lcdui/Item.html#HYPERLINK"><CODE>Item.HYPERLINK</CODE></A>, or <A HREF="../../../javax/microedition/lcdui/Item.html#BUTTON"><CODE>Item.BUTTON</CODE></A><DT><B>Throws:</B><DD><CODE>IllegalArgumentException</CODE> - if <code>appearanceMode</code> invalid<DT><B>Since: </B><DD>MIDP 2.0</DD></DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getText()"><!-- --></A><H3>getText</H3><PRE>public String <B>getText</B>()</PRE><DL><DD>Gets the text contents of the <code>StringItem</code>, or <code>null</code> if the <code>StringItem</code> is empty.<DD><DL><DT><B>Returns:</B><DD>a string with the content of the item<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/StringItem.html#setText(java.lang.String)"><CODE>setText(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setText(java.lang.String)"><!-- --></A><H3>setText</H3><PRE>public void <B>setText</B>(String text)</PRE><DL><DD>Sets the text contents of the <code>StringItem</code>. If text is <code>null</code>, the <code>StringItem</code> is set to be empty.<DD><DL><DT><B>Parameters:</B><DD><CODE>text</CODE> - the new content<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/StringItem.html#getText()"><CODE>getText()</CODE></A></DL></DD></DL><HR><A NAME="getAppearanceMode()"><!-- --></A><H3>getAppearanceMode</H3><PRE>public int <B>getAppearanceMode</B>()</PRE><DL><DD>Returns the appearance mode of the <code>StringItem</code>. See <a href="Item.html#appearance">Appearance Modes</a>.<DD><DL><DT><B>Returns:</B><DD>the appearance mode value, one of <A HREF="../../../javax/microedition/lcdui/Item.html#PLAIN"><CODE>Item.PLAIN</CODE></A>, <A HREF="../../../javax/microedition/lcdui/Item.html#HYPERLINK"><CODE>Item.HYPERLINK</CODE></A>, or <A HREF="../../../javax/microedition/lcdui/Item.html#BUTTON"><CODE>Item.BUTTON</CODE></A><DT><B>Since: </B><DD>MIDP 2.0</DD></DL></DD></DL><HR><A NAME="setFont(javax.microedition.lcdui.Font)"><!-- --></A><H3>setFont</H3><PRE>public void <B>setFont</B>(<A HREF="../../../javax/microedition/lcdui/Font.html">Font</A> font)</PRE><DL><DD>Sets the application's preferred font for rendering this <code>StringItem</code>. The font is a hint, and the implementation may disregard the application's preferred font. <p> The <code>font</code> parameter must be a valid <code>Font</code> object or <code>null</code>. If the <code>font</code> parameter is <code>null</code>, the implementation must use its default font to render the <code>StringItem</code>.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>font</CODE> - the preferred font to use to render this <code>StringItem</code><DT><B>Since: </B><DD>MIDP 2.0</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/StringItem.html#getFont()"><CODE>getFont()</CODE></A></DL></DD></DL><HR><A NAME="getFont()"><!-- --></A><H3>getFont</H3><PRE>public <A HREF="../../../javax/microedition/lcdui/Font.html">Font</A> <B>getFont</B>()</PRE><DL><DD>Gets the application's preferred font for rendering this <code>StringItem</code>. The value returned is the font that had been set by the application, even if that value had been disregarded by the implementation. If no font had been set by the application, or if the application explicitly set the font to <code>null</code>, the value is the default font chosen by the implementation.<DD><DL><DT><B>Returns:</B><DD>the preferred font to use to render this <code>StringItem</code><DT><B>Since: </B><DD>MIDP 2.0</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/StringItem.html#setFont(javax.microedition.lcdui.Font)"><CODE>setFont(javax.microedition.lcdui.Font)</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_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/StringItem.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>MIDP 2.0</strong></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/microedition/lcdui/Spacer.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/microedition/lcdui/TextBox.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="StringItem.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#fields_inherited_from_class_javax.microedition.lcdui.Item">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: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="mailto:jsr-118-comments@jcp.org">Send a comment or suggestion</a> Version 2.0 of Mobile Information Device Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright 1993-2002 Sun Microsystems, Inc. and Motorola, Inc. All Rights Reserved. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -