public class ActionRenderer
extends java.lang.Object
implements javax.swing.table.TableCellRenderer, javax.swing.table.TableCellEditor
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BUTTON_FONT
Property name for Action property to specify the Font for use on the
rendered button.
|
| Constructor and Description |
|---|
ActionRenderer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCellEditorListener(javax.swing.event.CellEditorListener l)
Adds a listener to the list that's notified when the editor
stops, or cancels editing.
|
void |
cancelCellEditing()
Tells the editor to cancel editing and not accept any partially
edited value.
|
java.lang.Object |
getCellEditorValue()
Returns the value contained in the editor.
|
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Sets an initial
value for the editor. |
java.awt.Component |
getTableCellRendererComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Returns the component used for drawing the cell.
|
boolean |
isCellEditable(java.util.EventObject anEvent)
Asks the editor if it can start editing using
anEvent. |
void |
removeCellEditorListener(javax.swing.event.CellEditorListener l)
Removes a listener from the list that's notified
|
boolean |
shouldSelectCell(java.util.EventObject anEvent)
Returns true if the editing cell should be selected, false otherwise.
|
boolean |
stopCellEditing()
Tells the editor to stop editing and accept any partially edited
value as the value of the editor.
|
public static final java.lang.String BUTTON_FONT
public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderertable - the JTable that is asking the
renderer to draw; can be nullvalue - the value of the cell to be rendered. It is
up to the specific renderer to interpret
and draw the value. For example, if
value
is the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null is a
valid valueisSelected - true if the cell is to be rendered with the
selection highlighted; otherwise falsehasFocus - if true, render cell appropriately. For
example, put a special border on the cell, if
the cell can be edited, render in the color used
to indicate editingrow - the row index of the cell being drawn. When
drawing the header, the value of
row is -1column - the column index of the cell being drawnpublic java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
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.
getTableCellEditorComponent in interface javax.swing.table.TableCellEditortable - the JTable that is asking the
editor to edit; can be nullvalue - the value of the cell to be edited; it is
up to the specific editor to interpret
and draw the value. For example, if value is
the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null
is a valid valueisSelected - true if the cell is to be rendered with
highlightingrow - the row of the cell being editedcolumn - the column of the cell being editedpublic void addCellEditorListener(javax.swing.event.CellEditorListener l)
addCellEditorListener in interface javax.swing.CellEditorl - the CellEditorListenerpublic void cancelCellEditing()
cancelCellEditing in interface javax.swing.CellEditorpublic java.lang.Object getCellEditorValue()
getCellEditorValue in interface javax.swing.CellEditorpublic boolean isCellEditable(java.util.EventObject anEvent)
anEvent.
anEvent is in the invoking component coordinate system.
The editor can not assume the Component returned by
getCellEditorComponent is installed. This method
is intended for the use of client to avoid the cost of setting up
and installing the editor component if editing is not possible.
If editing can be started this method returns true.isCellEditable in interface javax.swing.CellEditoranEvent - the event the editor should use to consider
whether to begin editing or notshouldSelectCell(java.util.EventObject)public void removeCellEditorListener(javax.swing.event.CellEditorListener l)
removeCellEditorListener in interface javax.swing.CellEditorl - the CellEditorListenerpublic boolean shouldSelectCell(java.util.EventObject anEvent)
shouldSelectCell in interface javax.swing.CellEditoranEvent - the event the editor should use to start
editingisCellEditable(java.util.EventObject)public boolean stopCellEditing()
stopCellEditing in interface javax.swing.CellEditor