📄 alert.html
字号:
<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/Alert.html#addCommand(javax.microedition.lcdui.Command)">addCommand</A></B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</CODE>
<BR>
Similar to <A HREF="../../../javax/microedition/lcdui/Displayable.html#addCommand(javax.microedition.lcdui.Command)"><CODE>Displayable.addCommand(javax.microedition.lcdui.Command)</CODE></A>, however when the application first adds a command to an <code>Alert</code>, <A HREF="../../../javax/microedition/lcdui/Alert.html#DISMISS_COMMAND"><CODE>DISMISS_COMMAND</CODE></A> is implicitly removed.</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/Alert.html#getDefaultTimeout()">getDefaultTimeout</A></B>()</CODE>
<BR>
Gets the default time for showing an <code>Alert</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Alert.html#getImage()">getImage</A></B>()</CODE>
<BR>
Gets the <code>Image</code> used in the <code>Alert</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../javax/microedition/lcdui/Gauge.html">Gauge</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Alert.html#getIndicator()">getIndicator</A></B>()</CODE>
<BR>
Gets the activity indicator for this <code>Alert</code>.</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/Alert.html#getString()">getString</A></B>()</CODE>
<BR>
Gets the text string used in the <code>Alert</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/Alert.html#getTimeout()">getTimeout</A></B>()</CODE>
<BR>
Gets the time this <code>Alert</code> will be shown.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../javax/microedition/lcdui/AlertType.html">AlertType</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Alert.html#getType()">getType</A></B>()</CODE>
<BR>
Gets the type of the <code>Alert</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/Alert.html#removeCommand(javax.microedition.lcdui.Command)">removeCommand</A></B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</CODE>
<BR>
Similar to <A HREF="../../../javax/microedition/lcdui/Displayable.html#removeCommand(javax.microedition.lcdui.Command)"><CODE>Displayable.removeCommand(javax.microedition.lcdui.Command)</CODE></A>, however when the application removes the last command from an <code>Alert</code>, <A HREF="../../../javax/microedition/lcdui/Alert.html#DISMISS_COMMAND"><CODE>DISMISS_COMMAND</CODE></A> is implicitly added.</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/Alert.html#setCommandListener(javax.microedition.lcdui.CommandListener)">setCommandListener</A></B>(<A HREF="../../../javax/microedition/lcdui/CommandListener.html">CommandListener</A> l)</CODE>
<BR>
The same as <A HREF="../../../javax/microedition/lcdui/Displayable.html#setCommandListener(javax.microedition.lcdui.CommandListener)"><CODE>Displayable.setCommandListener(javax.microedition.lcdui.CommandListener)</CODE></A> but with the following additional semantics.</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/Alert.html#setImage(javax.microedition.lcdui.Image)">setImage</A></B>(<A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> img)</CODE>
<BR>
Sets the <code>Image</code> used in the <code>Alert</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/Alert.html#setIndicator(javax.microedition.lcdui.Gauge)">setIndicator</A></B>(<A HREF="../../../javax/microedition/lcdui/Gauge.html">Gauge</A> indicator)</CODE>
<BR>
Sets an activity indicator on this <code>Alert</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/Alert.html#setString(java.lang.String)">setString</A></B>(<A HREF="../../../java/lang/String.html">String</A> str)</CODE>
<BR>
Sets the text string used in the <code>Alert</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/Alert.html#setTimeout(int)">setTimeout</A></B>(int time)</CODE>
<BR>
Set the time for which the <code>Alert</code> is to be shown.</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/Alert.html#setType(javax.microedition.lcdui.AlertType)">setType</A></B>(<A HREF="../../../javax/microedition/lcdui/AlertType.html">AlertType</A> type)</CODE>
<BR>
Sets the type of the <code>Alert</code>.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.lcdui.Displayable"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.microedition.lcdui.<A HREF="../../../javax/microedition/lcdui/Displayable.html">Displayable</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/lcdui/Displayable.html#getHeight()">getHeight</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#getTicker()">getTicker</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#getTitle()">getTitle</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#getWidth()">getWidth</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#isShown()">isShown</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#setTicker(javax.microedition.lcdui.Ticker)">setTicker</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#setTitle(java.lang.String)">setTitle</A>, <A HREF="../../../javax/microedition/lcdui/Displayable.html#sizeChanged(int, int)">sizeChanged</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="FOREVER"><!-- --></A><H3>
FOREVER</H3>
<PRE>
public static final int <B>FOREVER</B></PRE>
<DL>
<DD><code>FOREVER</code> indicates that an <code>Alert</code> is kept visible until the user dismisses it. It is used as a value for the parameter to <A HREF="../../../javax/microedition/lcdui/Alert.html#setTimeout(int)"><CODE>setTimeout()</CODE></A> to indicate that the alert is modal. Instead of waiting for a specified period of time, a modal <code>Alert</code> will wait for the user to take some explicit action, such as pressing a button, before proceeding to the next <code>Displayable</code>. <P>Value <code>-2</code> is assigned to <code>FOREVER</code>.</P></DL>
<HR>
<A NAME="DISMISS_COMMAND"><!-- --></A><H3>
DISMISS_COMMAND</H3>
<PRE>
public static final <A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> <B>DISMISS_COMMAND</B></PRE>
<DL>
<DD>A <code>Command</code> delivered to a listener to indicate that the <code>Alert</code> has been dismissed. This Command is implicitly present an on <code>Alert</code> whenever there are no other Commands present. The field values of <code>DISMISS_COMMAND</code> are as follows: <ul> <li>label = "" (an empty string)</li> <li>type = Command.OK</li> <li>priority = 0</li> </ul> <p>The label value visible to the application must be as specified above. However, the implementation may display <code>DISMISS_COMMAND</code> to the user using an implementation-specific label.</p> <p>Attempting to add or remove <code>DISMISS_COMMAND</code> from an <code>Alert</code> has no effect. However, <code>DISMISS_COMMAND</code> is treated as an ordinary <code>Command</code> if it is used with other <code>Displayable</code> types.</p><DD><DL>
<DT><B>Since: </B><DD>MIDP 2.0</DD>
</DL>
</DD>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Alert(java.lang.String)"><!-- --></A><H3>
Alert</H3>
<PRE>
public <B>Alert</B>(<A HREF="../../../java/lang/String.html">String</A> title)</PRE>
<DL>
<DD>Constructs a new, empty <code>Alert</code> object with the given title. If <code>null</code> is passed, the <code>Alert</code> will have no title. Calling this constructor is equivalent to calling <pre> <code>Alert(title, null, null, null)</code> </pre><DD><DL>
<DT><B>Parameters:</B><DD><CODE>title</CODE> - the title string, or <code>null</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Alert.html#Alert(java.lang.String, java.lang.String, javax.microedition.lcdui.Image, javax.microedition.lcdui.AlertType)"><CODE>Alert(String, String, Image, AlertType)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="Alert(java.lang.String, java.lang.String, javax.microedition.lcdui.Image, javax.microedition.lcdui.AlertType)"><!-- --></A><H3>
Alert</H3>
<PRE>
public <B>Alert</B>(<A HREF="../../../java/lang/String.html">String</A> title, <A HREF="../../../java/lang/String.html">String</A> alertText, <A HREF="../../../javax/microedition/lcdui/Image.html">Image</A> alertImage, <A HREF="../../../javax/microedition/lcdui/AlertType.html">AlertType</A> alertType)</PRE>
<DL>
<DD>Constructs a new <code>Alert</code> object with the given title, content string and image, and alert type. The layout of the contents is implementation dependent. The timeout value of this new alert is the same value that is returned by <code>getDefaultTimeout()</code>. The <code>Image</code> provided may either be mutable or immutable. The handling and behavior of specific <code>AlertTypes</code> is described in <A HREF="../../../javax/microedition/lcdui/AlertType.html"><CODE>AlertType</CODE></A>. <code>null</code> is allowed as the value of the <code>alertType</code> parameter and indicates that the <code>Alert</code> is not to have a specific alert type. <code>DISMISS_COMMAND</code> is the only <code>Command</code> present on the new <code>Alert</code>. The <code>CommandListener</code> associated with the new <code>Alert</code> is the <em>default listener</em>. Its behavior is described in more detail in the section <a href="#commands">Commands and Listeners</a>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>title</CODE> - the title string, or <code>null</code> if there is no title<DD><CODE>alertText</CODE> - the string contents, or <code>null</code> if there is no string<DD><CODE>alertImage</CODE> - the image contents, or <code>null</code> if there is no image<DD><CODE>alertType</CODE> - the type of the <code>Alert</code>, or <code>null</code> if the <code>Alert</code> has no specific type</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="getDefaultTimeout()"><!-- --></A><H3>
getDefaultTimeout</H3>
<PRE>
public int <B>getDefaultTimeout</B>()</PRE>
<DL>
<DD>Gets the default time for showing an <code>Alert</code>. This is either a positive value, which indicates a time in milliseconds, or the special value <A HREF="../../../javax/microedition/lcdui/Alert.html#FOREVER"><CODE>FOREVER</CODE></A>, which indicates that <code>Alerts</code> are modal by default. The value returned will vary across implementations and is presumably tailored to be suitable for each.<DD><DL>
<DT><B>Returns:</B><DD>default timeout in milliseconds, or <code>FOREVER</code></DL>
</DD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -