javax.swing

Class DefaultCellEditor

Implemented Interfaces:
CellEditor, Serializable, TableCellEditor, TreeCellEditor

public class DefaultCellEditor
extends AbstractCellEditor
implements TableCellEditor, TreeCellEditor

The default implementation of TableCellEditor and TreeCellEditor. It provides editor components for some standard object types.
See Also:
Serialized Form

Nested Class Summary

protected class
DefaultCellEditor.EditorDelegate
Delegates a couple of method calls (such as isCellEditable(EventObject) to the component it contains and listens for events that indicate that editing has stopped.

Field Summary

protected int
clickCountToStart
clickCountToStart
protected DefaultCellEditor.EditorDelegate
delegate
delegate
protected JComponent
editorComponent
editorComponent

Fields inherited from class javax.swing.AbstractCellEditor

changeEvent, listenerList

Constructor Summary

DefaultCellEditor(JCheckBox checkbox)
Constructor DefaultCellEditor
DefaultCellEditor(JComboBox combobox)
Constructor DefaultCellEditor
DefaultCellEditor(JTextField textfield)
Constructor DefaultCellEditor

Method Summary

void
cancelCellEditing()
cancelCellEditing
Object
getCellEditorValue()
getCellEditorValue
int
getClickCountToStart()
getClickCountToStart
Component
getComponent()
getComponent
Component
getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
getTableCellEditorComponent
Component
getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
Sets an initial value for the editor.
boolean
isCellEditable(EventObject event)
isCellEditable
void
setClickCountToStart(int count)
setClickCountToStart
boolean
shouldSelectCell(EventObject event)
shouldSelectCell
boolean
stopCellEditing()
stopCellEditing

Methods inherited from class javax.swing.AbstractCellEditor

addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

clickCountToStart

protected int clickCountToStart
clickCountToStart

delegate

protected DefaultCellEditor.EditorDelegate delegate
delegate

editorComponent

protected JComponent editorComponent
editorComponent

Constructor Details

DefaultCellEditor

public DefaultCellEditor(JCheckBox checkbox)
Constructor DefaultCellEditor
Parameters:
checkbox - TODO

DefaultCellEditor

public DefaultCellEditor(JComboBox combobox)
Constructor DefaultCellEditor
Parameters:
combobox - TODO

DefaultCellEditor

public DefaultCellEditor(JTextField textfield)
Constructor DefaultCellEditor
Parameters:
textfield - TODO

Method Details

cancelCellEditing

public void cancelCellEditing()
cancelCellEditing
Specified by:
cancelCellEditing in interface CellEditor
Overrides:
cancelCellEditing in interface AbstractCellEditor

getCellEditorValue

public Object getCellEditorValue()
getCellEditorValue
Specified by:
getCellEditorValue in interface CellEditor

getClickCountToStart

public int getClickCountToStart()
getClickCountToStart

getComponent

public Component getComponent()
getComponent

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
getTableCellEditorComponent
Specified by:
getTableCellEditorComponent in interface TableCellEditor
Parameters:
table - TODO
value - TODO
isSelected - TODO
row - TODO
column - TODO

getTreeCellEditorComponent

public Component getTreeCellEditorComponent(JTree tree,
                                            Object value,
                                            boolean isSelected,
                                            boolean expanded,
                                            boolean leaf,
                                            int row)
Sets an initial value for the editor. This will cause the editor to stopEditing and lose any partially edited value if the editor is editing when this method is called. Returns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input.
Specified by:
getTreeCellEditorComponent in interface TreeCellEditor
Parameters:
tree - - the JTree that is asking the editor to edit; this parameter can be null
value - - the value of the cell to be edited
isSelected - - true is the cell is to be renderer with selection highlighting
expanded - - true if the node is expanded
leaf - - true if the node is a leaf node
row - - the row index of the node being edited

isCellEditable

public boolean isCellEditable(EventObject event)
isCellEditable
Specified by:
isCellEditable in interface CellEditor
Overrides:
isCellEditable in interface AbstractCellEditor
Parameters:
event - TODO

setClickCountToStart

public void setClickCountToStart(int count)
setClickCountToStart
Parameters:
count - TODO

shouldSelectCell

public boolean shouldSelectCell(EventObject event)
shouldSelectCell
Specified by:
shouldSelectCell in interface CellEditor
Overrides:
shouldSelectCell in interface AbstractCellEditor
Parameters:
event - TODO

stopCellEditing

public boolean stopCellEditing()
stopCellEditing
Specified by:
stopCellEditing in interface CellEditor
Overrides:
stopCellEditing in interface AbstractCellEditor

DefaultCellEditor.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.