⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 choice.java

📁 j2me is based on j2mepolish, client & server for mobile application. menu sample
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	 * @param imagePart the image part of the element, or  null if there is no image part
	 * @throws IndexOutOfBoundsException if elementNum is invalid
	 * @throws NullPointerException if stringPart is null
	 */
	public void set(int elementNum, String stringPart, Image imagePart);

	/**
	 * Gets a boolean value indicating whether this element is selected.
	 * The <code>elementNum</code> parameter must be within the range
	 * <code>[0..size()-1]</code>, inclusive.
	 * 
	 * @param elementNum the index of the element to be queried
	 * @return selection state of the element
	 * @throws IndexOutOfBoundsException if elementNum is invalid
	 */
	public boolean isSelected(int elementNum);

	/**
	 * Returns the index number of an element in the <code>Choice</code> that is
	 * selected. For
	 * <code>Choice</code> types <code>EXCLUSIVE</code>,
	 * <code>POPUP</code>, and <code>IMPLICIT</code>
	 * there is at most one element selected, so
	 * this method is useful for determining the user's
	 * choice. Returns <code>-1</code> if
	 * the <code>Choice</code> has no elements (and therefore has no
	 * selected elements).
	 * 
	 * <p>For <code>MULTIPLE</code>, this always returns
	 * <code>-1</code> because no single
	 * value can in general represent the state of such a <code>Choice</code>.
	 * To get the complete state of a <code>MULTIPLE</code> <code>Choice</code>,
	 * see <A HREF="../../../javax/microedition/lcdui/Choice.html#getSelectedFlags(boolean[])"><CODE>getSelectedFlags</CODE></A>.</p>
	 * 
	 * @return index of selected element, or -1 if none
	 * @see #setSelectedIndex(int, boolean)
	 */
	public int getSelectedIndex();

	/**
	 * Queries the state of a <code>Choice</code> and returns the
	 * state of all elements
	 * in the
	 * boolean array
	 * <code>selectedArray_return</code>. <strong>Note:</strong> this
	 * is a result parameter.
	 * It must be at least as long as the size
	 * of the <code>Choice</code> as returned by <code>size()</code>.
	 * If the array is longer, the extra
	 * elements are set to <code>false</code>.
	 * 
	 * <p>This call is valid for all types of
	 * <code>Choices</code>. For <code>MULTIPLE</code>, any
	 * number of elements may be selected and set to <code>true</code>
	 * in the result
	 * array. For <code>EXCLUSIVE</code>, <code>POPUP</code>, and
	 * <code>IMPLICIT</code>
	 * exactly one element will be selected (unless there are
	 * zero elements in the <code>Choice</code>). </p>
	 * 
	 * @param selectedArray_return - array to contain the results
	 * @return the number of selected elements in the Choice
	 * @throws IllegalArgumentException - if selectedArray_return is shorter than the size of the Choice.
	 * @throws NullPointerException - if selectedArray_return is null
	 * @see #setSelectedFlags(boolean[])
	 */
	public int getSelectedFlags(boolean[] selectedArray_return);

	/**
	 * For <code>MULTIPLE</code>, this simply sets an individual
	 * element's selected
	 * state.
	 * 
	 * <P>For <code>EXCLUSIVE</code> and <code>POPUP</code>,
	 * this can be used only to select any
	 * element, that is, the <code> selected </code> parameter must be <code>
	 * true </code>. When an element is selected, the previously
	 * selected element
	 * is deselected. If <code> selected </code> is <code> false </code>, this
	 * call is ignored. If element was already selected, the call has
	 * no effect.</P>
	 * 
	 * <P>For <code>IMPLICIT</code>,
	 * this can be used only to select any
	 * element, that is, the <code> selected </code> parameter must be <code>
	 * true </code>. When an element is selected, the previously
	 * selected element
	 * is deselected. If <code> selected </code> is <code> false </code>, this
	 * call is ignored. If element was already selected, the call has
	 * no effect.</P>
	 * 
	 * <P>The call to <code>setSelectedIndex</code> does not cause
	 * implicit activation of
	 * any <code>Command</code>.
	 * </P>
	 * 
	 * <p>For all list types, the <code>elementNum</code> parameter
	 * must be within the range
	 * <code>[0..size()-1]</code>, inclusive. </p>
	 * 
	 * @param elementNum - the index of the element, starting from zero
	 * @param selected - the state of the element, where true means selected and false means not selected
	 * @throws IndexOutOfBoundsException - if elementNum is invalid
	 * @see #getSelectedIndex()
	 */
	public void setSelectedIndex(int elementNum, boolean selected);

	/**
	 * Attempts to set the selected state of every element in the
	 * <code>Choice</code>.
	 * The array
	 * must be at least as long as the size of the
	 * <code>Choice</code>. If the array is
	 * longer, the additional values are ignored.
	 * 
	 * <p>For <code>Choice</code> objects of type
	 * <code>MULTIPLE</code>, this sets the selected
	 * state of every
	 * element in the <code>Choice</code>. An arbitrary number of
	 * elements may be selected.
	 * </p>
	 * 
	 * <p>For <code>Choice</code> objects of type
	 * <code>EXCLUSIVE</code>, <code>POPUP</code>,
	 * and <code>IMPLICIT</code>, exactly one array
	 * element must have the value <code>true</code>. If no element is
	 * <code>true</code>, the
	 * first element
	 * in the <code>Choice</code> will be selected. If two or more
	 * elements are <code>true</code>, the
	 * implementation will choose the first <code>true</code> element
	 * and select it. </p>
	 * 
	 * @param selectedArray - an array in which the method collect the selection status
	 * @throws IllegalArgumentException - if selectedArray is shorter than the size of the Choice
	 * @throws NullPointerException - if selectedArray is null
	 * @see #getSelectedFlags(boolean[])
	 */
	public void setSelectedFlags(boolean[] selectedArray);

	/**
	 * Sets the application's preferred policy for fitting
	 * <code>Choice</code> element
	 * contents to the available screen space. The set policy applies for all
	 * elements of the <code>Choice</code> object.  Valid values are
	 * <A HREF="../../../javax/microedition/lcdui/Choice.html#TEXT_WRAP_DEFAULT"><CODE>TEXT_WRAP_DEFAULT</CODE></A>, <A HREF="../../../javax/microedition/lcdui/Choice.html#TEXT_WRAP_ON"><CODE>TEXT_WRAP_ON</CODE></A>,
	 * and <A HREF="../../../javax/microedition/lcdui/Choice.html#TEXT_WRAP_OFF"><CODE>TEXT_WRAP_OFF</CODE></A>. Fit policy is a hint, and the
	 * implementation may disregard the application's preferred policy.
	 * 
	 * @param fitPolicy - preferred content fit policy for choice elements
	 * @throws IllegalArgumentException - if fitPolicy is invalid
	 * @see #getFitPolicy()
	 * @since  MIDP 2.0
	 */
	public void setFitPolicy(int fitPolicy);

	/**
	 * Gets the application's preferred policy for fitting
	 * <code>Choice</code> element
	 * contents to the available screen space.  The value returned is the
	 * policy that had been set by the application, even if that value had
	 * been disregarded by the implementation.
	 * 
	 * @return one of TEXT_WRAP_DEFAULT, TEXT_WRAP_ON, or TEXT_WRAP_OFF
	 * @see #setFitPolicy(int)
	 * @since  MIDP 2.0
	 */
	public int getFitPolicy();

	/**
	 * Sets the application's preferred font for
	 * rendering the specified element of this <code>Choice</code>.
	 * An element's font is a hint, and the implementation may disregard
	 * the application's preferred font.
	 * 
	 * <p> The <code>elementNum</code> parameter must be within the range
	 * <code>[0..size()-1]</code>, inclusive.</p>
	 * 
	 * <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 element.</p>
	 * 
	 * @param elementNum - the index of the element, starting from zero
	 * @param font - the preferred font to use to render the element
	 * @throws IndexOutOfBoundsException - if elementNum is invalid
	 * @see #getFont(int)
	 * @since  MIDP 2.0
	 */
	public void setFont(int elementNum, Font font);

	/**
	 * Gets the application's preferred font for
	 * rendering the specified element of this <code>Choice</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.
	 * 
	 * <p> The <code>elementNum</code> parameter must be within the range
	 * <code>[0..size()-1]</code>, inclusive.</p>
	 * 
	 * @param elementNum - the index of the element, starting from zero
	 * @return the preferred font to use to render the element
	 * @throws IndexOutOfBoundsException - if elementNum is invalid
	 * @see #setFont(int, javax.microedition.lcdui.Font)
	 * @since  MIDP 2.0
	 */
	public Font getFont(int elementNum);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -