📄 gauge.html
字号:
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>
<HR>
<A NAME="setDefaultCommand(javax.microedition.lcdui.Command)"><!-- --></A><H3>
setDefaultCommand</H3>
<PRE>
public void <B>setDefaultCommand</B>(<A HREF="../../../javax/microedition/lcdui/Command.html">Command</A> cmd)</PRE>
<DL>
<DD>Sets default <code>Command</code> for this <code>Item</code>. If the <code>Item</code> previously had a default <code>Command</code>, that <code>Command</code> is no longer the default, but it remains present on the <code>Item</code>. <p>If not <code>null</code>, the <code>Command</code> object passed becomes the default <code>Command</code> for this <code>Item</code>. If the <code>Command</code> object passed is not currently present on this <code>Item</code>, it is added as if <A HREF="../../../javax/microedition/lcdui/Gauge.html#addCommand(javax.microedition.lcdui.Command)"><CODE>addCommand(javax.microedition.lcdui.Command)</CODE></A> had been called before it is made the default <code>Command</code>.</p> <p>If <code>null</code> is passed, the <code>Item</code> is set to have no default <code>Command</code>. The previous default <code>Command</code>, if any, remains present on the <code>Item</code>. </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#setDefaultCommand(javax.microedition.lcdui.Command)">setDefaultCommand</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>cmd</CODE> - the command to be used as this <code>Item's</code> default <code>Command</code>, or <code>null</code> if there is to be no default command<DT><B>Throws:</B><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>
</DL>
</DD>
</DL>
<HR>
<A NAME="setValue(int)"><!-- --></A><H3>
setValue</H3>
<PRE>
public void <B>setValue</B>(int value)</PRE>
<DL>
<DD>Sets the current value of this <code>Gauge</code> object. <p>If the gauge is interactive, or if it is non-interactive with definite range, the following rules apply. If the value is less than zero, zero is used. If the current value is greater than the maximum value, the current value is set to be equal to the maximum value. </p> <p> If this <code>Gauge</code> object is a non-interactive gauge with indefinite range, then value must be one of <code>CONTINUOUS_IDLE</code>, <code>INCREMENTAL_IDLE</code>, <code>CONTINUOUS_RUNNING</code>, or <code>INCREMENTAL_UPDATING</code>. Other values will cause an exception to be thrown.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the new value<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if value is not one of <code>CONTINUOUS_IDLE</code>, <code>INCREMENTAL_IDLE</code>, <code>CONTINUOUS_RUNNING</code>, or <code>INCREMENTAL_UPDATING</code> for non-interactive gauges with indefinite range<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Gauge.html#CONTINUOUS_IDLE"><CODE>CONTINUOUS_IDLE</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#INCREMENTAL_IDLE"><CODE>INCREMENTAL_IDLE</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#CONTINUOUS_RUNNING"><CODE>CONTINUOUS_RUNNING</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#INCREMENTAL_UPDATING"><CODE>INCREMENTAL_UPDATING</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#getValue()"><CODE>getValue()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getValue()"><!-- --></A><H3>
getValue</H3>
<PRE>
public int <B>getValue</B>()</PRE>
<DL>
<DD>Gets the current value of this <code>Gauge</code> object. <p> If this <code>Gauge</code> object is a non-interactive gauge with indefinite range, the value returned will be one of <code>CONTINUOUS_IDLE</code>, <code>INCREMENTAL_IDLE</code>, <code>CONTINUOUS_RUNNING</code>, or <code>INCREMENTAL_UPDATING</code>. Otherwise, it will be an integer between zero and the gauge's maximum value, inclusive.</p><DD><DL>
<DT><B>Returns:</B><DD>current value of the <code>Gauge</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Gauge.html#CONTINUOUS_IDLE"><CODE>CONTINUOUS_IDLE</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#INCREMENTAL_IDLE"><CODE>INCREMENTAL_IDLE</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#CONTINUOUS_RUNNING"><CODE>CONTINUOUS_RUNNING</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#INCREMENTAL_UPDATING"><CODE>INCREMENTAL_UPDATING</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#setValue(int)"><CODE>setValue(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setMaxValue(int)"><!-- --></A><H3>
setMaxValue</H3>
<PRE>
public void <B>setMaxValue</B>(int maxValue)</PRE>
<DL>
<DD>Sets the maximum value of this <code>Gauge</code> object. <p>For interactive gauges, the new maximum value must be greater than zero, otherwise an exception is thrown. For non-interactive gauges, the new maximum value must be greater than zero or equal to the special value <code>INDEFINITE</code>, otherwise an exception is thrown. </p> <p>If the new maximum value is greater than zero, this provides the gauge with a definite range. If the gauge previously had a definite range, and if the current value is greater than new maximum value, the current value is set to be equal to the new maximum value. If the gauge previously had a definite range, and if the current value is less than or equal to the new maximum value, the current value is left unchanged. </p> <p>If the new maximum value is greater than zero, and if the gauge had previously had indefinite range, this new maximum value provides it with a definite range. Its graphical representation must change accordingly, the previous state of <code>CONTINUOUS_IDLE</code>, <code>INCREMENTAL_IDLE</code>, <code>CONTINUOUS_RUNNING</code>, or <code>INCREMENTAL_UPDATING</code> is ignored, and the current value is set to zero. </p> <p>If this gauge is non-interactive and the new maximum value is <code>INDEFINITE</code>, this gives the gauge indefinite range. If the gauge previously had a definite range, its graphical representation must change accordingly, the previous value is ignored, and the current state is set to <code>CONTINUOUS_IDLE</code>. If the gauge previously had an indefinite range, setting the maximum value to <code>INDEFINITE</code> will have no effect. </p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>maxValue</CODE> - the new maximum value<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>maxValue</code> is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Gauge.html#INDEFINITE"><CODE>INDEFINITE</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#getMaxValue()"><CODE>getMaxValue()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getMaxValue()"><!-- --></A><H3>
getMaxValue</H3>
<PRE>
public int <B>getMaxValue</B>()</PRE>
<DL>
<DD>Gets the maximum value of this <code>Gauge</code> object. <p>If this gauge is interactive, the maximum value will be a positive integer. If this gauge is non-interactive, the maximum value will be a positive integer (indicating that the gauge has definite range) or the special value <code>INDEFINITE</code> (indicating that the gauge has indefinite range).</p><DD><DL>
<DT><B>Returns:</B><DD>the maximum value of the <code>Gauge</code>, or <code>INDEFINITE</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Gauge.html#INDEFINITE"><CODE>INDEFINITE</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Gauge.html#setMaxValue(int)"><CODE>setMaxValue(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isInteractive()"><!-- --></A><H3>
isInteractive</H3>
<PRE>
public boolean <B>isInteractive</B>()</PRE>
<DL>
<DD>Tells whether the user is allowed to change the value of the <code>Gauge</code>.<DD><DL>
<DT><B>Returns:</B><DD>a boolean indicating whether the <code>Gauge</code> is interactive</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/Gauge.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/Form.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/lcdui/Graphics.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="Gauge.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 + -