FileDocCategorySizeDatePackage
SimpleModel.javaAPI DocExample1907Mon Nov 09 12:45:52 GMT 1998None

SimpleModel

public class SimpleModel extends Object implements SimpleModelInterface

Fields Summary
protected transient ChangeEvent
changeEvent
protected EventListenerList
listenerList
private int
value
private boolean
activated
Constructors Summary
public SimpleModel()


       
public SimpleModel(int v)

 value = v; 
public SimpleModel(boolean b)

 activated = b; 
public SimpleModel(int v, boolean b)

 
        value = v;
        activated = b;
    
Methods Summary
public voidaddChangeListener(javax.swing.event.ChangeListener l)

        listenerList.add(ChangeListener.class, l);
    
protected voidfireChange()

        Object[] listeners = listenerList.getListenerList();
        for (int i = listeners.length - 2; i >= 0; i -=2 ) {
            if (listeners[i] == ChangeListener.class) {
                if (changeEvent == null) {
                    changeEvent = new ChangeEvent(this);
                }
                ((ChangeListener)listeners[i+1]).stateChanged(changeEvent);
            }          
        }
    
public intgetValue()

 return value; 
public booleanisActivated()

 return activated; 
public voidremoveChangeListener(javax.swing.event.ChangeListener l)

        listenerList.remove(ChangeListener.class, l);
    
public synchronized voidsetActivated(boolean b)

       if (b != activated) {
           boolean oldValue = activated;
           activated = b;
           fireChange(); 
       }
    
public synchronized voidsetValue(int v)

       if (v != value) {
           int oldValue = value;
           value = v;
           fireChange(); 
       }
    
public java.lang.StringtoString()

        String modelString = "value=" + getValue() + ", " +
            "activated=" + isActivated();
        return getClass().getName() + "[" + modelString + "]";