javax.swing
Class AbstractListModel

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.AbstractListModel
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel
Direct Known Subclasses:
BasicDirectoryModel sample code for javax.swing.plaf.basic.BasicDirectoryModel definition code for javax.swing.plaf.basic.BasicDirectoryModel , DefaultComboBoxModel sample code for javax.swing.DefaultComboBoxModel definition code for javax.swing.DefaultComboBoxModel , DefaultListModel sample code for javax.swing.DefaultListModel definition code for javax.swing.DefaultListModel , MetalFileChooserUI.DirectoryComboBoxModel sample code for javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxModel definition code for javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxModel , MetalFileChooserUI.FilterComboBoxModel sample code for javax.swing.plaf.metal.MetalFileChooserUI.FilterComboBoxModel definition code for javax.swing.plaf.metal.MetalFileChooserUI.FilterComboBoxModel

public abstract class AbstractListModel
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

The abstract definition for the data model that provides a List with its contents.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Field Summary
protected  EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList listenerList sample code for javax.swing.AbstractListModel.listenerList definition code for javax.swing.AbstractListModel.listenerList
           
 
Constructor Summary
AbstractListModel sample code for javax.swing.AbstractListModel.AbstractListModel() definition code for javax.swing.AbstractListModel.AbstractListModel() ()
           
 
Method Summary
 void addListDataListener sample code for javax.swing.AbstractListModel.addListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.AbstractListModel.addListDataListener(javax.swing.event.ListDataListener) (ListDataListener sample code for javax.swing.event.ListDataListener definition code for javax.swing.event.ListDataListener  l)
          Adds a listener to the list that's notified each time a change to the data model occurs.
protected  void fireContentsChanged sample code for javax.swing.AbstractListModel.fireContentsChanged(java.lang.Object, int, int) definition code for javax.swing.AbstractListModel.fireContentsChanged(java.lang.Object, int, int) (Object sample code for java.lang.Object definition code for java.lang.Object  source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements of the list change.
protected  void fireIntervalAdded sample code for javax.swing.AbstractListModel.fireIntervalAdded(java.lang.Object, int, int) definition code for javax.swing.AbstractListModel.fireIntervalAdded(java.lang.Object, int, int) (Object sample code for java.lang.Object definition code for java.lang.Object  source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements are added to the model.
protected  void fireIntervalRemoved sample code for javax.swing.AbstractListModel.fireIntervalRemoved(java.lang.Object, int, int) definition code for javax.swing.AbstractListModel.fireIntervalRemoved(java.lang.Object, int, int) (Object sample code for java.lang.Object definition code for java.lang.Object  source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements are removed from the model.
 ListDataListener sample code for javax.swing.event.ListDataListener definition code for javax.swing.event.ListDataListener [] getListDataListeners sample code for javax.swing.AbstractListModel.getListDataListeners() definition code for javax.swing.AbstractListModel.getListDataListeners() ()
          Returns an array of all the list data listeners registered on this AbstractListModel.
<T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener >
T[]
getListeners sample code for javax.swing.AbstractListModel.getListeners(java.lang.Class) definition code for javax.swing.AbstractListModel.getListeners(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this model.
 void removeListDataListener sample code for javax.swing.AbstractListModel.removeListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.AbstractListModel.removeListDataListener(javax.swing.event.ListDataListener) (ListDataListener sample code for javax.swing.event.ListDataListener definition code for javax.swing.event.ListDataListener  l)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface javax.swing.ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel
getElementAt sample code for javax.swing.ListModel.getElementAt(int) definition code for javax.swing.ListModel.getElementAt(int) , getSize sample code for javax.swing.ListModel.getSize() definition code for javax.swing.ListModel.getSize()
 

Field Detail

listenerList sample code for javax.swing.AbstractListModel.listenerList

protected EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList  listenerList
Constructor Detail

AbstractListModel sample code for javax.swing.AbstractListModel() definition code for javax.swing.AbstractListModel()

public AbstractListModel()
Method Detail

addListDataListener sample code for javax.swing.AbstractListModel.addListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.AbstractListModel.addListDataListener(javax.swing.event.ListDataListener)

public void addListDataListener(ListDataListener sample code for javax.swing.event.ListDataListener definition code for javax.swing.event.ListDataListener  l)
Adds a listener to the list that's notified each time a change to the data model occurs.

Specified by:
addListDataListener sample code for javax.swing.ListModel.addListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.ListModel.addListDataListener(javax.swing.event.ListDataListener) in interface ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel
Parameters:
l - the ListDataListener to be added

removeListDataListener sample code for javax.swing.AbstractListModel.removeListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.AbstractListModel.removeListDataListener(javax.swing.event.ListDataListener)

public void removeListDataListener(ListDataListener sample code for javax.swing.event.ListDataListener definition code for javax.swing.event.ListDataListener  l)
Removes a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeListDataListener sample code for javax.swing.ListModel.removeListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.ListModel.removeListDataListener(javax.swing.event.ListDataListener) in interface ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel
Parameters:
l - the ListDataListener to be removed

getListDataListeners sample code for javax.swing.AbstractListModel.getListDataListeners() definition code for javax.swing.AbstractListModel.getListDataListeners()

public ListDataListener sample code for javax.swing.event.ListDataListener definition code for javax.swing.event.ListDataListener [] getListDataListeners()
Returns an array of all the list data listeners registered on this AbstractListModel.

Returns:
all of this model's ListDataListeners, or an empty array if no list data listeners are currently registered
Since:
1.4
See Also:
addListDataListener(javax.swing.event.ListDataListener) sample code for javax.swing.AbstractListModel.addListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.AbstractListModel.addListDataListener(javax.swing.event.ListDataListener) , removeListDataListener(javax.swing.event.ListDataListener) sample code for javax.swing.AbstractListModel.removeListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.AbstractListModel.removeListDataListener(javax.swing.event.ListDataListener)

fireContentsChanged sample code for javax.swing.AbstractListModel.fireContentsChanged(java.lang.Object, int, int) definition code for javax.swing.AbstractListModel.fireContentsChanged(java.lang.Object, int, int)

protected void fireContentsChanged(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                                   int index0,
                                   int index1)
AbstractListModel subclasses must call this method after one or more elements of the list change. The changed elements are specified by the closed interval index0, index1 -- the endpoints are included. Note that index0 need not be less than or equal to index1.

Parameters:
source - the ListModel that changed, typically "this"
index0 - one end of the new interval
index1 - the other end of the new interval
See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList , DefaultListModel sample code for javax.swing.DefaultListModel definition code for javax.swing.DefaultListModel

fireIntervalAdded sample code for javax.swing.AbstractListModel.fireIntervalAdded(java.lang.Object, int, int) definition code for javax.swing.AbstractListModel.fireIntervalAdded(java.lang.Object, int, int)

protected void fireIntervalAdded(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                                 int index0,
                                 int index1)
AbstractListModel subclasses must call this method after one or more elements are added to the model. The new elements are specified by a closed interval index0, index1 -- the enpoints are included. Note that index0 need not be less than or equal to index1.

Parameters:
source - the ListModel that changed, typically "this"
index0 - one end of the new interval
index1 - the other end of the new interval
See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList , DefaultListModel sample code for javax.swing.DefaultListModel definition code for javax.swing.DefaultListModel

fireIntervalRemoved sample code for javax.swing.AbstractListModel.fireIntervalRemoved(java.lang.Object, int, int) definition code for javax.swing.AbstractListModel.fireIntervalRemoved(java.lang.Object, int, int)

protected void fireIntervalRemoved(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                                   int index0,
                                   int index1)
AbstractListModel subclasses must call this method after one or more elements are removed from the model. index0 and index1 are the end points of the interval that's been removed. Note that index0 need not be less than or equal to index1.

Parameters:
source - the ListModel that changed, typically "this"
index0 - one end of the removed interval, including index0
index1 - the other end of the removed interval, including index1
See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList , DefaultListModel sample code for javax.swing.DefaultListModel definition code for javax.swing.DefaultListModel

getListeners sample code for javax.swing.AbstractListModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>) definition code for javax.swing.AbstractListModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>)

public <T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener > T[] getListeners(Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
Returns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a list model m for its list data listeners with the following code:

ListDataListener[] ldls = (ListDataListener[])(m.getListeners(ListDataListener.class));
If no such listeners exist, this method returns an empty array.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.3
See Also:
getListDataListeners() sample code for javax.swing.AbstractListModel.getListDataListeners() definition code for javax.swing.AbstractListModel.getListDataListeners()