Methods Summary |
---|
public void | addChangeListener(javax.swing.event.ChangeListener l)Adds a ChangeListener to the button.
listenerList.add(ChangeListener.class, l);
|
public void | clearSelection()
setSelectedIndex(-1);
|
protected void | fireStateChanged()Notifies all listeners that have registered interest for
notification on this event type. The event instance
is created lazily.
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==ChangeListener.class) {
// Lazily create the event:
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((ChangeListener)listeners[i+1]).stateChanged(changeEvent);
}
}
|
public javax.swing.event.ChangeListener[] | getChangeListeners()Returns an array of all the change listeners
registered on this DefaultSingleSelectionModel .
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
|
public T[] | getListeners(java.lang.Class listenerType)Returns an array of all the objects currently registered as
FooListener s
upon this model.
FooListener s
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.
return listenerList.getListeners(listenerType);
|
public int | getSelectedIndex()
// implements javax.swing.SingleSelectionModel
return index;
|
public boolean | isSelected()
boolean ret = false;
if (getSelectedIndex() != -1) {
ret = true;
}
return ret;
|
public void | removeChangeListener(javax.swing.event.ChangeListener l)Removes a ChangeListener from the button.
listenerList.remove(ChangeListener.class, l);
|
public void | setSelectedIndex(int index)
if (this.index != index) {
this.index = index;
fireStateChanged();
}
|