public class javax.swing
DefaultSingleSelectionModel


Show All Login
Java SE 6
  
Implements: SingleSelectionModel, Serializable
Details
A generic implementation of SingleSelectionModel.

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 java.beans.XMLEncoder.
version1.36 11/17/05


Fields
protected ChangeEvent changeEvent
protected EventListenerList listenerList
The collection of registered listeners

Constructors
public DefaultSingleSelectionModel()

Methods
public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.
public void clearSelection()
protected void fireStateChanged() Details
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.
See also javax.swing.event.EventListenerList
public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.

Properties
public ChangeListener[] getChangeListeners() Details
Returns an array of all the change listeners registered on this DefaultSingleSelectionModel.
returnall of this model's ChangeListeners or an empty array if no change listeners are currently registered
since1.4
See also addChangeListener, removeChangeListener
public EventListener[]<T> getListeners(Class listenerType) Details
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 DefaultSingleSelectionModel instance m for its change listeners with the following code:

ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));
If no such listeners exist, this method returns an empty array.
listenerTypethe type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
returnan array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added
ThrowsClassCastException: if listenerType doesn't specify a class or interface that implements java.util.EventListener
since1.3
See also getChangeListeners
public boolean isSelected()
public void setSelectedIndex(int index)
public int getSelectedIndex()