APIdia Launch Partner
Top Description Methods
javax.swing

public Interface SingleSelectionModel

Known Direct Implementers
javax.swing.DefaultSingleSelectionModel
Imports
javax.swing.event.*

A model that supports at most one indexed selection.
Author
Dave Moore
Since
1.2

Method Summary

Modifier and TypeMethod and Description
public void
addChangeListener(ChangeListener
the ChangeListener to add
listener
)

Adds listener as a listener to changes in the model.

public void
clearSelection()

Clears the selection (to -1).

public int

Returns:

the model's selection, or -1 if there is no selection
getSelectedIndex
()

Returns the model's selection.

public boolean

Returns:

true if a value is currently selected
isSelected
()

Returns true if the selection model currently has a selected value.

public void
removeChangeListener(ChangeListener
the ChangeListener to remove
listener
)

Removes listener as a listener to changes in the model.

public void
setSelectedIndex(int
an int specifying the model selection
index
)

Sets the model's selected index to index.

Method Detail

addChangeListenerback to summary
public void addChangeListener(ChangeListener listener)

Adds listener as a listener to changes in the model.

Parameters
listener:ChangeListener

the ChangeListener to add

clearSelectionback to summary
public void clearSelection()

Clears the selection (to -1).

getSelectedIndexback to summary
public int getSelectedIndex()

Returns the model's selection.

Returns:int

the model's selection, or -1 if there is no selection

See Also
setSelectedIndex
isSelectedback to summary
public boolean isSelected()

Returns true if the selection model currently has a selected value.

Returns:boolean

true if a value is currently selected

removeChangeListenerback to summary
public void removeChangeListener(ChangeListener listener)

Removes listener as a listener to changes in the model.

Parameters
listener:ChangeListener

the ChangeListener to remove

setSelectedIndexback to summary
public void setSelectedIndex(int index)

Sets the model's selected index to index. Notifies any listeners if the model changes

Parameters
index:int

an int specifying the model selection

See Also
getSelectedIndex, addChangeListener