Java PrimerMethod Properties in Java
- By by Dirk Riehle
- April 18, 2000
Listing 1. The set method "void component(int, String)" of VectorName in a preliminary version.
/**
* Set a name component to a new value.
* @methodtype set
*/
public void component(int index, String cs) throws InvalidIndexException {
assertIsValidIndex(index); // check whether index is valid
fComponents.setElementAt(cs, index); // set new value
notifyListeners(new ComponentChangeEvent(...)); // inform listeners
}