FileDocCategorySizeDatePackage
VolumeEditor.javaAPI DocExample3562Thu Oct 24 20:14:26 BST 2002None

VolumeEditor

public class VolumeEditor extends JSlider implements TableCellEditor

Fields Summary
public OkCancel
helper
protected transient Vector
listeners
protected transient int
originalValue
protected transient boolean
editing
Constructors Summary
public VolumeEditor()


    
    super(SwingConstants.HORIZONTAL);
    listeners = new Vector();
  
Methods Summary
public voidaddCellEditorListener(javax.swing.event.CellEditorListener cel)

    listeners.addElement(cel);
  
public voidcancelCellEditing()

    fireEditingCanceled();
    editing = false;
    helper.setVisible(false);
  
protected voidfireEditingCanceled()

    setValue(originalValue);
    ChangeEvent ce = new ChangeEvent(this);
    for (int i = listeners.size() - 1; i >= 0; i--) {
      ((CellEditorListener)listeners.elementAt(i)).editingCanceled(ce);
    }
  
protected voidfireEditingStopped()

    ChangeEvent ce = new ChangeEvent(this);
    for (int i = listeners.size() - 1; i >= 0; i--) {
      ((CellEditorListener)listeners.elementAt(i)).editingStopped(ce);
    }
  
public java.lang.ObjectgetCellEditorValue()

return new Integer(getValue());
public java.awt.ComponentgetTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)

    if (value == null) {
      return this;
    }
    if (value instanceof Volume) {
      setValue(((Volume)value).getVolume());
    }
    else {
      setValue(0);
    }
    table.setRowSelectionInterval(row, row);
    table.setColumnSelectionInterval(column, column);
    originalValue = getValue();
    editing = true;
    Point p = table.getLocationOnScreen();
    Rectangle r = table.getCellRect(row, column, true);
    helper.setLocation(r.x + p.x + getWidth() - 50, r.y + p.y + getHeight());
    helper.setVisible(true);
    return this;
  
public booleanisCellEditable(java.util.EventObject eo)

return true;
public voidremoveCellEditorListener(javax.swing.event.CellEditorListener cel)

    listeners.removeElement(cel);
  
public booleanshouldSelectCell(java.util.EventObject eo)

    return true;
  
public booleanstopCellEditing()

    fireEditingStopped();
    editing = false;
    helper.setVisible(false);
    return true;