public interface

SingleSelectionModel

javax.swing.SingleSelectionModel
Known Indirect Subclasses

Class Overview

A model that supports at most one indexed selection.

Summary

Public Methods
abstract void addChangeListener(ChangeListener listener)
Adds listener as a listener to changes in the model.
abstract void clearSelection()
Clears the selection (to -1).
abstract int getSelectedIndex()
Returns the model's selection.
abstract boolean isSelected()
Returns true if the selection model currently has a selected value.
abstract void removeChangeListener(ChangeListener listener)
Removes listener as a listener to changes in the model.
abstract void setSelectedIndex(int index)
Sets the model's selected index to index.

Public Methods

public abstract void addChangeListener (ChangeListener listener)

Adds listener as a listener to changes in the model.

Parameters
listener the ChangeListener to add

public abstract void clearSelection ()

Clears the selection (to -1).

public abstract int getSelectedIndex ()

Returns the model's selection.

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

public abstract boolean isSelected ()

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

Returns
  • true if a value is currently selected

public abstract void removeChangeListener (ChangeListener listener)

Removes listener as a listener to changes in the model.

Parameters
listener the ChangeListener to remove

public abstract void setSelectedIndex (int index)

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

Parameters
index an int specifying the model selection