本文整理汇总了Java中java.awt.peer.ListPeer.deselect方法的典型用法代码示例。如果您正苦于以下问题:Java ListPeer.deselect方法的具体用法?Java ListPeer.deselect怎么用?Java ListPeer.deselect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.ListPeer
的用法示例。
在下文中一共展示了ListPeer.deselect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deselect
import java.awt.peer.ListPeer; //导入方法依赖的package包/类
/**
* Deselects the item at the specified index.
* <p>
* Note that passing out of range parameters is invalid,
* and will result in unspecified behavior.
* <p>
* If the item at the specified index is not selected,
* then the operation is ignored.
* @param index the position of the item to deselect
* @see #select
* @see #getSelectedItem
* @see #isIndexSelected
*/
public synchronized void deselect(int index) {
ListPeer peer = (ListPeer)this.peer;
if (peer != null) {
if (isMultipleMode() || (getSelectedIndex() == index)) {
peer.deselect(index);
}
}
for (int i = 0 ; i < selected.length ; i++) {
if (selected[i] == index) {
int newsel[] = new int[selected.length - 1];
System.arraycopy(selected, 0, newsel, 0, i);
System.arraycopy(selected, i+1, newsel, i, selected.length - (i+1));
selected = newsel;
return;
}
}
}
示例2: deselect
import java.awt.peer.ListPeer; //导入方法依赖的package包/类
/**
* Makes the item at the specified index not selected.
*
* @param index The index of the item to unselect.
*/
public synchronized void deselect(int index)
{
if (isSelected(index))
{
ListPeer lp = (ListPeer)getPeer();
if (lp != null)
lp.deselect(index);
int[] temp = new int[selected.length - 1];
for (int i = 0; i < temp.length; i++)
{
if (selected[i] != index)
temp[i] = selected[i];
else
{
System.arraycopy(selected, i + 1, temp, i,
selected.length - i - 1);
break;
}
}
selected = temp;
}
}
示例3: deselect
import java.awt.peer.ListPeer; //导入方法依赖的package包/类
/**
* Makes the item at the specified index not selected.
*
* @param index The index of the item to unselect.
*/
public synchronized void deselect(int index)
{
if (isSelected(index))
{
ListPeer lp = (ListPeer)getPeer();
if (lp != null)
lp.deselect(index);
int[] temp = new int[selected.length - 1];
for (int i = 0; i < temp.length; i++)
{
if (selected[i] != index)
temp[i] = selected[i];
else
{
System.arraycopy(selected, i + 1, temp, i,
selected.length - i - 1);
break;
}
}
selected = temp;
}
}
示例4: deselect
import java.awt.peer.ListPeer; //导入方法依赖的package包/类
/**
* Deselects the item at the specified index.
* <p>
* Note that passing out of range parameters is invalid,
* and will result in unspecified behavior.
* <p>
* If the item at the specified index is not selected,
* then the operation is ignored.
* @param index the position of the item to deselect
* @see #select
* @see #getSelectedItem
* @see #isIndexSelected
*/
public synchronized void deselect(int index) {
ListPeer peer = (ListPeer)this.peer;
if (peer != null) {
peer.deselect(index);
}
for (int i = 0 ; i < selected.length ; i++) {
if (selected[i] == index) {
int newsel[] = new int[selected.length - 1];
System.arraycopy(selected, 0, newsel, 0, i);
System.arraycopy(selected, i+1, newsel, i, selected.length - (i+1));
selected = newsel;
return;
}
}
}