jwo.utils.gui
Class EditableHeader
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.table.JTableHeader
jwo.utils.gui.EditableHeader
- All Implemented Interfaces:
- Accessible, CellEditorListener, EventListener, ImageObserver, MenuContainer, Serializable, TableColumnModelListener
- public class EditableHeader
- extends JTableHeader
- implements CellEditorListener
A table header that can be edited by double clicking on the
header entry.
- Version:
- 2.1, 19th August, 2004.
- Author:
- Based on the code provided by Nobuo Tamemasa, modified by Jo Wood.
- See Also:
- Serialized Form
Methods inherited from class javax.swing.table.JTableHeader |
columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, createDefaultColumnModel, createDefaultRenderer, getAccessibleContext, getColumnModel, getDefaultRenderer, getDraggedColumn, getDraggedDistance, getHeaderRect, getReorderingAllowed, getResizingAllowed, getResizingColumn, getTable, getToolTipText, getUI, getUIClassID, getUpdateTableInRealTime, initializeLocalVars, paramString, resizeAndRepaint, setColumnModel, setDefaultRenderer, setDraggedColumn, setDraggedDistance, setReorderingAllowed, setResizingAllowed, setResizingColumn, setTable, setUI, setUpdateTableInRealTime |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
EditableHeader
public EditableHeader(TableColumnModel columnModel,
CellEditorListener editorListener)
- Creates a new editable header based on the given column model.
- Parameters:
columnModel
- Table column model uponwhich to base table header.editorListener
- Class to be informed if a header cell has been edited.
updateUI
public void updateUI()
- Notification from the UIManager that the look and feel (L&F) has changed.
Replaces the current UI object with the latest version from the UIManager.
editCellAt
public boolean editCellAt(int index,
EventObject e)
- Allows the cell at the given index to be edited.
- Parameters:
index
- Index of header cell to edit.e
- GUI event that initiated the editing.
- Returns:
- True if edited.
isCellEditable
public boolean isCellEditable(int index)
- Reports whether the given header cell is editable.
- Parameters:
index
- Index of cell to query.
- Returns:
- True if given cell is editable.
getCellEditor
public TableCellEditor getCellEditor(int index)
- Reports the cell editor used to edit the given header cell.
- Parameters:
index
- Index of header cell from which to retrieve editor.
- Returns:
- Editor of the given cell.
getCellEditor
public TableCellEditor getCellEditor()
- Reports the cell editor used to edit header cells.
- Returns:
- Editor used to edit header.
setCellEditor
public void setCellEditor(TableCellEditor newEditor)
- Sets the cell editor used to edit the header cells.
- Parameters:
newEditor
- Editor to associate with the header.
prepareEditor
public Component prepareEditor(TableCellEditor editor,
int index)
- Prepares the header at the given location for editing.
- Parameters:
editor
- Editor to associate with the header cell.index
- Index of header cell to edit.
getEditorComponent
public Component getEditorComponent()
- Reports the GUI component used to represent the editable cell.
- Returns:
- Editor component.
setEditingColumn
public void setEditingColumn(int column)
- Sets the column to be edited.
- Parameters:
column
- Column to edit.
getEditingColumn
public int getEditingColumn()
- Reports the column to be edited.
- Returns:
- Column to edit.
removeEditor
public void removeEditor()
- Removes the cell editor from the header.
isEditing
public boolean isEditing()
- Reports whether or not there is a cell being edited
- Returns:
- True if a cell is being edited.
editingStopped
public void editingStopped(ChangeEvent e)
- Called whenever editing has finished.
- Specified by:
editingStopped
in interface CellEditorListener
- Parameters:
e
- Event assoicated with finishing of editing.
editingCanceled
public void editingCanceled(ChangeEvent e)
- Removes editor from the header.
- Specified by:
editingCanceled
in interface CellEditorListener
- Parameters:
e
- Event that prompted cancellation of editing.
Copyright Jo Wood, 1996-2004, last modified, 3rd September, 2004