📄 imageitem.html
字号:
<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>ImageItem</code>. To provide hyperlink- or button-like behavior, the application should associate a default <code>Command</code> with this <code>ImageItem</code> and add an <code>ItemCommandListener</code> to this <code>ImageItem</code>. <p>Here is an example showing the use of an <code>ImageItem</code> as a button: <p> <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> ImageItem imgItem = new ImageItem("Default: ", img, Item.LAYOUT_CENTER, null, Item.BUTTON); imgItem.setDefaultCommand( new Command("Set", Command.ITEM, 1); // icl is ItemCommandListener imgItem.setItemCommandListener(icl); </code></pre> </TD> </TR> </TABLE><DD><DL>
<DT><B>Parameters:</B><DD><CODE>label</CODE> - the label string<DD><CODE>image</CODE> - the image, can be mutable or immutable<DD><CODE>layout</CODE> - a combination of layout directives<DD><CODE>altText</CODE> - the text that may be used in place of the image<DD><CODE>appearanceMode</CODE> - the appearance mode of the <code>ImageItem</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 the <code>layout</code> value is not a legal combination of directives<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="getImage()"><!-- --></A><H3>
getImage</H3>
<PRE>
public <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> <B>getImage</B>()</PRE>
<DL>
<DD>Gets the image contained within the <code>ImageItem</code>, or <code>null</code> if there is no contained image.<DD><DL>
<DT><B>Returns:</B><DD>image used by the <code>ImageItem</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/ImageItem.html#setImage(javax.microedition.lcdui.Image)"><CODE>setImage(javax.microedition.lcdui.Image)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setImage(javax.microedition.lcdui.Image)"><!-- --></A><H3>
setImage</H3>
<PRE>
public void <B>setImage</B>(<A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> img)</PRE>
<DL>
<DD>Sets the <code>Image</code> object contained within the <code>ImageItem</code>. The image may be mutable or immutable. If <code>img</code> is <code>null</code>, the <code>ImageItem</code> is set to be empty. If <code>img</code> is mutable, the effect is as if a snapshot is taken of <code>img's</code> contents immediately prior to the call to <code>setImage</code>. This snapshot is used whenever the contents of the <code>ImageItem</code> are to be displayed. If <code>img</code> is already the <code>Image</code> of this <code>ImageItem</code>, the effect is as if a new snapshot of img's contents is taken. Thus, after painting into a mutable image contained by an <code>ImageItem</code>, the application can call <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> imageItem.setImage(imageItem.getImage()); </code></pre> </TD> </TR> </TABLE> <p>to refresh the <code>ImageItem's</code> snapshot of its Image.</p> <p>If the <code>ImageItem</code> is visible on the display when the snapshot is updated through a call to <code>setImage</code>, the display is updated with the new snapshot as soon as it is feasible for the implementation to so do.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>img</CODE> - the <code>Image</code> for this <code>ImageItem</code>, or <code>null</code> if none<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/ImageItem.html#getImage()"><CODE>getImage()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getAltText()"><!-- --></A><H3>
getAltText</H3>
<PRE>
public <A HREF="../../../java/lang/String.html">String</A> <B>getAltText</B>()</PRE>
<DL>
<DD>Gets the text string to be used if the image exceeds the device's capacity to display it.<DD><DL>
<DT><B>Returns:</B><DD>the alternate text value, or <code>null</code> if none<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/ImageItem.html#setAltText(java.lang.String)"><CODE>setAltText(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setAltText(java.lang.String)"><!-- --></A><H3>
setAltText</H3>
<PRE>
public void <B>setAltText</B>(<A HREF="../../../java/lang/String.html">String</A> text)</PRE>
<DL>
<DD>Sets the alternate text of the <code>ImageItem</code>, or <code>null</code> if no alternate text is provided.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - the new alternate text<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/ImageItem.html#getAltText()"><CODE>getAltText()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getLayout()"><!-- --></A><H3>
getLayout</H3>
<PRE>
public int <B>getLayout</B>()</PRE>
<DL>
<DD>Gets the layout directives used for placing the image.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Item.html#getLayout()">getLayout</A></CODE> in class <CODE><A HREF="../../../javax/microedition/lcdui/Item.html">Item</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a combination of layout directive values<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/ImageItem.html#setLayout(int)"><CODE>setLayout(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setLayout(int)"><!-- --></A><H3>
setLayout</H3>
<PRE>
public void <B>setLayout</B>(int layout)</PRE>
<DL>
<DD>Sets the layout directives.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/microedition/lcdui/Item.html#setLayout(int)">setLayout</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>layout</CODE> - a combination of layout directive values<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the value of <code>layout</code> is not a valid combination of layout directives<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/ImageItem.html#getLayout()"><CODE>getLayout()</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>ImageItem</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>
<!-- ========= 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/ImageItem.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/Image.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/lcdui/Item.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="ImageItem.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>
<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 + -