Java プラットフォーム 1.2

javax.swing
クラス DefaultListSelectionModel

java.lang.Object
  |
  +--javax.swing.DefaultListSelectionModel

public class DefaultListSelectionModel
extends Object
implements ListSelectionModel, Cloneable, Serializable

リスト選択のデフォルトデータモデルです。

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。今後の Swing リリースでは、長期間の持続性をサポートする予定です。

関連項目:
ListSelectionModel, 直列化された形式

フィールドの概要
protected  boolean leadAnchorNotificationEnabled
           
protected  EventListenerList listenerList
           
 
コンストラクタの概要
DefaultListSelectionModel()
           
 
メソッドの概要
 void addListSelectionListener(ListSelectionListener l)
           
 void addSelectionInterval(int index0, int index1)
           
 void clearSelection()
           
 Object clone()
          レシーバの複製を、選択状態を同じにして返します。
protected  void fireValueChanged(boolean isAdjusting)
          一連の調整が終了したことをリスナーに通知します。
protected  void fireValueChanged(int firstIndex, int lastIndex)
          firstIndex、lastIndex 間で選択の値が変更されたことを ListSelectionListeners に通知します。
protected  void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
           
 int getAnchorSelectionIndex()
           
 int getLeadSelectionIndex()
           
 int getMaxSelectionIndex()
           
 int getMinSelectionIndex()
           
 int getSelectionMode()
           
 boolean getValueIsAdjusting()
           
 void insertIndexInterval(int index, int length, boolean before)
          インデックスの前または後で始まる length インデックスを挿入します。
 boolean isLeadAnchorNotificationEnabled()
          leadAnchorNotificationEnabled フラグの値を返します。
 boolean isSelectedIndex(int index)
           
 boolean isSelectionEmpty()
           
 void removeIndexInterval(int index0, int index1)
          index0、index1 (上下限値を含む) 間のインデックスを選択モデルから削除します。
 void removeListSelectionListener(ListSelectionListener l)
           
 void removeSelectionInterval(int index0, int index1)
           
 void setAnchorSelectionIndex(int anchorIndex)
          アンカー選択インデックスを設定して、すべての選択値を変更しないままにします。
 void setLeadAnchorNotificationEnabled(boolean flag)
          leadAnchorNotificationEnabled フラグの値を設定します。
 void setLeadSelectionIndex(int leadIndex)
          先頭の選択インデックスを設定し、アンカーと新しい先頭の間の値が、すべて選択またはすべて選択解除のどちらかであることを保証します。
 void setSelectionInterval(int index0, int index1)
           
 void setSelectionMode(int selectionMode)
           
 void setValueIsAdjusting(boolean isAdjusting)
           
 String toString()
          このオブジェクトのプロパティを表示および識別する文字列を返します。
 
クラス java.lang.Object から継承したメソッド
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

listenerList

protected EventListenerList listenerList

leadAnchorNotificationEnabled

protected boolean leadAnchorNotificationEnabled
コンストラクタの詳細

DefaultListSelectionModel

public DefaultListSelectionModel()
メソッドの詳細

getMinSelectionIndex

public int getMinSelectionIndex()
定義:
インタフェース ListSelectionModel 内の getMinSelectionIndex

getMaxSelectionIndex

public int getMaxSelectionIndex()
定義:
インタフェース ListSelectionModel 内の getMaxSelectionIndex

getValueIsAdjusting

public boolean getValueIsAdjusting()
定義:
インタフェース ListSelectionModel 内の getValueIsAdjusting

getSelectionMode

public int getSelectionMode()
定義:
インタフェース ListSelectionModel 内の getSelectionMode

setSelectionMode

public void setSelectionMode(int selectionMode)
定義:
インタフェース ListSelectionModel 内の setSelectionMode

isSelectedIndex

public boolean isSelectedIndex(int index)
定義:
インタフェース ListSelectionModel 内の isSelectedIndex

isSelectionEmpty

public boolean isSelectionEmpty()
定義:
インタフェース ListSelectionModel 内の isSelectionEmpty

addListSelectionListener

public void addListSelectionListener(ListSelectionListener l)
定義:
インタフェース ListSelectionModel 内の addListSelectionListener

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener l)
定義:
インタフェース ListSelectionModel 内の removeListSelectionListener

fireValueChanged

protected void fireValueChanged(boolean isAdjusting)
一連の調整が終了したことをリスナーに通知します。

fireValueChanged

protected void fireValueChanged(int firstIndex,
                                int lastIndex)
firstIndex、lastIndex 間で選択の値が変更されたことを ListSelectionListeners に通知します。

fireValueChanged

protected void fireValueChanged(int firstIndex,
                                int lastIndex,
                                boolean isAdjusting)
パラメータ:
firstIndex - 先頭のインデックス
index1 - 末尾のインデックス
isAdjusting - 一連の変更の最後の変更である場合は true
関連項目:
EventListenerList

setLeadAnchorNotificationEnabled

public void setLeadAnchorNotificationEnabled(boolean flag)
leadAnchorNotificationEnabled フラグの値を設定します。
関連項目:
isLeadAnchorNotificationEnabled()

isLeadAnchorNotificationEnabled

public boolean isLeadAnchorNotificationEnabled()
leadAnchorNotificationEnabled フラグの値を返します。leadAnchorNotificationEnabled が true の場合、選択領域のすべての変更に加えて、先頭インデックスとアンカーインデックスへの変更を含む境界を使って、モデルは通知イベントを生成します。フラグを false に設定すると、最後の変更後に選択または選択解除された要素のみを含むように、イベントの境界を限定できます。どの方法でも、モデルは先頭変数とアンカー変数を内部的に管理し続けます。デフォルトは true です。
戻り値:
leadAnchorNotificationEnabled フラグの値
関連項目:
setLeadAnchorNotificationEnabled(boolean)

clearSelection

public void clearSelection()
定義:
インタフェース ListSelectionModel 内の clearSelection

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
定義:
インタフェース ListSelectionModel 内の setSelectionInterval

addSelectionInterval

public void addSelectionInterval(int index0,
                                 int index1)
定義:
インタフェース ListSelectionModel 内の addSelectionInterval

removeSelectionInterval

public void removeSelectionInterval(int index0,
                                    int index1)
定義:
インタフェース ListSelectionModel 内の removeSelectionInterval

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
インデックスの前または後で始まる length インデックスを挿入します。インデックスの値それ自身が選択された場合は、新しく挿入された項目のすべてを設定し、そうでない場合には選択されないままにします。このメソッドは通常、選択モデルをデータモデル内の対応する変更に同期させるために呼び出されます。
定義:
インタフェース ListSelectionModel 内の insertIndexInterval

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
index0、index1 (上下限値を含む) 間のインデックスを選択モデルから削除します。これは通常、選択モデルをデータモデル内の対応する変更に同期させるために呼び出されます。index0 は (通常通り) <= index1 である必要はないことに注意してください。
定義:
インタフェース ListSelectionModel 内の removeIndexInterval

setValueIsAdjusting

public void setValueIsAdjusting(boolean isAdjusting)
定義:
インタフェース ListSelectionModel 内の setValueIsAdjusting

toString

public String toString()
このオブジェクトのプロパティを表示および識別する文字列を返します。
戻り値:
このオブジェクトの文字列表現
オーバーライド:
クラス Object 内の toString

clone

public Object clone()
             throws CloneNotSupportedException
レシーバの複製を、選択状態を同じにして返します。listenerLists は複製されません。
例外:
CloneNotSupportedException - レシーバが (a) Cloneable インタフェースを実装しない場合、あるいは (b) clone メソッドを定義しない場合
オーバーライド:
クラス Object 内の clone

getAnchorSelectionIndex

public int getAnchorSelectionIndex()
定義:
インタフェース ListSelectionModel 内の getAnchorSelectionIndex

getLeadSelectionIndex

public int getLeadSelectionIndex()
定義:
インタフェース ListSelectionModel 内の getLeadSelectionIndex

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int anchorIndex)
アンカー選択インデックスを設定して、すべての選択値を変更しないままにします。leadAnchorNotificationEnabled が true の場合、新旧のアンカーセルを対象とする通知を送信します。
定義:
インタフェース ListSelectionModel 内の setAnchorSelectionIndex
関連項目:
getAnchorSelectionIndex(), setLeadSelectionIndex(int)

setLeadSelectionIndex

public void setLeadSelectionIndex(int leadIndex)
先頭の選択インデックスを設定し、アンカーと新しい先頭の間の値が、すべて選択またはすべて選択解除のどちらかであることを保証します。アンカーインデックスの値を選択すると、[anchor, oldLeadIndex] 範囲内のすべての値をまずクリアしてから、[anchor, newLeadIndex] 範囲内のすべての値を選択します。oldLeadIndex は古い leadIndex を表し、newLeadIndex は新しい leadIndex を表します。

アンカーインデックスの値が選択されていない場合、同じことを逆に行い、古い範囲の値を選択してから新しい範囲の値を選択解除します。

この変更のイベントを 1 つ生成し、すべてのリスナーに通知します。このイベント内で最小限の境界を生成することを目的に、1 回のパスで操作を行います。この方法では、ブロードキャストされた ListSelectionEvent 内の先頭と末尾のインデックスは、このメソッドによって実際に値が変更されたセルを参照します。しかし、この操作を 2 回のステップで処理すると、選択状態の効果は同じでも、2 つのイベントが生成される上に、設定のためにクリアされたセルを含んでしまい、変更された値の境界が広くなります。

このメソッドを UI クラスの mouseDragged() メソッドで使うと、選択を拡張できます。

定義:
インタフェース ListSelectionModel 内の setLeadSelectionIndex
関連項目:
getLeadSelectionIndex(), setAnchorSelectionIndex(int)

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.