📄 stringitem.html
字号:
<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>(<A HREF="../../../java/lang/String.html">String</A> label, <A HREF="../../../java/lang/String.html">String</A> 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><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></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 <A HREF="../../../java/lang/String.html">String</A> <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>(<A HREF="../../../java/lang/String.html">String</A> 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>
<HR>
<A NAME="setPreferredSize(int, int)"><!-- --></A><H3>
setPreferredSize</H3>
<PRE>
public void <B>setPreferredSize</B>(int width, int height)</PRE>
<DL>
<DD>Sets the preferred width and height for this <code>Item</code>. Values for width and height less than <code>-1</code> are illegal. If the width is between zero and the minimum width, inclusive, the minimum width is used instead. If the height is between zero and the minimum height, inclusive, the minimum height is used instead. <p>Supplying a width or height value greater than the minimum width or height <em>locks</em> that dimension to the supplied value. The implementation may silently enforce a maximum dimension for an <code>Item</code> based on factors such as the screen size. Supplying a value of <code>-1</code> for the width or height unlocks that dimension. See <a href="#sizes">Item Sizes</a> for a complete discussion.</p> <p>It is illegal to call this method if this <code>Item</code> is contained within an <code>Alert</code>.</p><DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Item.html#setPreferredSize(int, int)">setPreferredSize</A></CODE> in class <CODE><A HREF="../../../javax/microedition/lcdui/Item.html">Item</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>width</CODE> - the value to which the width should be locked, or <code>-1</code> to unlock<DD><CODE>height</CODE> - the value to which the height should be locked, or <code>-1</code> to unlock<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if width or height is less than <code>-1</code><DD><CODE><A HREF="../../../java/lang/IllegalStateException.html">IllegalStateException</A></CODE> - if this <code>Item</code> is contained within an <code>Alert</code><DT><B>Since: </B><DD>MIDP 2.0</DD>
<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Item.html#getPreferredHeight()"><CODE>Item.getPreferredHeight()</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Item.html#getPreferredWidth()"><CODE>Item.getPreferredWidth()</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>MID Profile</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:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -