|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
com.zfqjava.swing.JDataGrid
public class JDataGrid
JDataGrid provides a data grid, add some features
such as row header, cell attributes, cell merge and split,
undo and redo support.
The DataGridModel provides model support for cell attributes,
cell class, cell editable, undo support, cell merge and split and other
set methods for column name and column class. It's TableModel subclass.
The ObjectCellRenderer provides the
basic cell renderer for render cell attributes.
The ObjectCellEditor provides the
basic cell editor.
JDataGrid provides a row header when add into JScrollPane
container, and build-in Date, Number and
Boolean and String and Multiple line
String renderer and editor to support cell attributes and other
features.
Client Property:
| Name | Value | Default Value |
|---|---|---|
| JDataGrid.clickCountToStartsEdit | java.lang.Integer | null |
| JDataGrid.autoSetsCellValue | java.lang.Boolean | Boolean.TRUE |
| JDataGrid.autoSetsCellClass | java.lang.Boolean | Boolean.TRUE |
| JDataGrid.columnSortingEnabled | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.switchUnsortedOrderEnabled | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.stringEscapeChar | java.lang.Character | null |
| JDataGrid.clearCellOnStartsEdit | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.selectionStyle |
|
Classic |
| JDataGrid.fillCellValueOnly | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.activateLinkOnModifierDown | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.clearSelectionOnDataChanged | java.lang.Boolean | Boolean.TRUE |
| CellEditor.dispatchEventOnStopEditingDisabled | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.generateHyperlinkEventForURLValue | java.lang.Boolean | Boolean.TRUE |
| JDataGrid.toggleSelectionOnCtrlDown | java.lang.Boolean | Boolean.FALSE |
| JDataGrid.notEditableCellRendererDisabled | java.lang.Boolean | Boolean.FALSE |
Note:
Since JDataGrid is compitable with JTable
at API level, use it just replace JTable
with JDataGrid.
| Nested Class Summary | |
|---|---|
protected class |
JDataGrid.AccessibleJDataGrid
This class implements accessibility support for the JDataGrid class. |
| Nested classes/interfaces inherited from class javax.swing.JTable |
|---|
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
COMMIT
Identifies when stop editing, AbstractCellEditor.commitEdit should be invoked. |
static int |
COMMIT_OR_EDITING
Identifies when stop editing, AbstractCellEditor.commitEdit should be invoked. |
static int |
COMMIT_OR_REVERT
Identifies when stop editing, AbstractCellEditor.commitEdit should be invoked. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JDataGrid()
Constructs a default JDataGrid that is initialized with a default
data model, a default column model, and a default selection
model. |
|
JDataGrid(int numRows,
int numColumns)
Constructs a JDataGrid with numRows
and numColumns of empty cells using
DefaultTableModel. |
|
JDataGrid(Object[][] rowData,
Object[] columnNames)
Constructs a JDataGrid to display the values in the two dimensional array,
rowData, with column names, columnNames. |
|
JDataGrid(TableModel dm)
Constructs a JDataGrid that is initialized with
dm as the data model, a default column model,
and a default selection model. |
|
JDataGrid(TableModel dm,
TableColumnModel cm)
Constructs a JDataGrid that is initialized with
dm as the data model, cm
as the column model, and a default selection model. |
|
JDataGrid(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
Constructs a JDataGrid that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model. |
|
JDataGrid(Vector rowData,
Vector columnNames)
Constructs a JDataGrid to display the values in the
Vector of Vectors, rowData,
with column names, columnNames. |
|
| Method Summary | |
|---|---|
void |
addCellEditorListener(CellEditorListener l)
Adds a CellEditorListener to the listener list. |
void |
addColumn(TableColumn aColumn)
|
void |
addHyperlinkListener(HyperlinkListener listener)
Adds a hyperlink listener for notification of any changes, for example when a link is selected and entered. |
void |
addUndoableEditListener(UndoableEditListener l)
Registers the given observer to begin receiving notifications when undoable edits are made to the data grid. |
void |
cellChanged(DataGridModelEvent e)
Invoked when this dataGrid's DataGridModel generates
a DataGridModelEvent. |
void |
cellMerged(CellSpanEvent e)
|
void |
cellSplitted(CellSpanEvent e)
|
void |
changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
|
void |
changeSelection(int anchorRow,
int leadRow,
int anchorColumn,
int leadColumn,
boolean toggle,
boolean extend,
boolean includeSpan)
Changes the selection of JDataGrid. |
void |
changeSelection(int firstRow,
int lastRow,
int firstColumn,
int lastColumn,
int anchorRow,
int leadRow,
int anchorColumn,
int leadColumn,
boolean toggle,
boolean extend,
boolean includeSpan)
Changes the selection of JDataGrid. |
void |
clearSelection()
|
void |
columnMoved(TableColumnModelEvent e)
|
void |
columnRemoved(TableColumnModelEvent e)
|
void |
columnSelectionChanged(ListSelectionEvent e)
|
protected void |
configureEnclosingScrollPane()
|
protected CellSelectionModel |
createCellSelectionModel()
Creates the default cell selection model. |
protected CellSpanModel |
createCellSpanModel()
Creates the default cell span model for the TableModel, if the model is DataGridModel,use DataGridModel as the cell span model. |
protected SizeModel |
createColumnSizeModel()
Creates the default column size model. |
protected AbstractButton |
createCornerButton()
Creates a corner button. |
DataGridModel |
createDataGridModel()
Creates a new default DataGridModel for datagrid. |
void |
createDefaultColumnsFromModel()
|
protected void |
createDefaultEditors()
|
protected void |
createDefaultRenderers()
|
protected JLineBar |
createRowHeader()
Creates a row header. |
protected SizeModel |
createRowSizeModel()
Creates the default row size model. |
protected void |
doHyperlinkUpdate(HyperlinkEvent e)
Handles the HyperlinkEvent, and do the default behavior, such as launch a browser. |
void |
doLayout()
|
boolean |
editCellAt(int row,
int column,
EventObject e)
|
void |
fireHyperlinkUpdate(HyperlinkEvent e)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireUndoableEditHappened(UndoableEdit edit)
Notifies all listeners that have registered interest for notification on this event type. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JDataGrid. |
Color |
getAlternatingRowBackground()
Returns the odd row background color. |
Color |
getAlternatingRowForeground()
Returns the odd row foreground color. |
AttributeSet |
getCellAttributes()
Returns all selected cell attributes in common. |
AttributeSet |
getCellAttributes(int row,
int column)
Returns the cell attributes. |
Class |
getCellClass(int row,
int column)
Returns the cell class. |
TableCellEditor |
getCellEditor(int row,
int column)
|
CellEditorComponentType |
getCellEditorComponentTypeByClass(Class c)
Returns the cell editor component type for the specified class type. |
CellEditorComponentType |
getCellEditorComponentTypeByColumn(int column)
Returns the cell renderer component type for the specified class type. |
CellEditorListener[] |
getCellEditorListeners()
Returns an array of all the CellEditorListeners added
to this AbstractCellEditor with addCellEditorListener(). |
CellManager |
getCellManager()
Returns the cell manager. |
Rectangle |
getCellRect(Cell c,
boolean includeSpacing)
Returns a rectangle for the cell that lies at the intersection of c. |
Rectangle |
getCellRect(Cell c,
boolean includeSpacing,
Rectangle rect)
|
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing)
|
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing,
boolean includeSpan)
|
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing,
Rectangle rect)
|
TableCellRenderer |
getCellRenderer(int row,
int column)
|
CellRendererComponentType |
getCellRendererComponentTypeByClass(Class c)
Returns the cell renderer component type for the specified class type. |
CellRendererComponentType |
getCellRendererComponentTypeByColumn(int column)
Returns the cell renderer component type for the specified class type. |
CellSelectionModel |
getCellSelectionModel()
Returns the cell selection model. |
CellSpanModel |
getCellSpanModel()
Returns the cell span model. |
int |
getColumnHeaderHeight()
Returns the column header height. |
Component |
getColumnHeaderView()
Returns the column header view. |
SizeModel |
getColumnSizeModel()
Returns the column size model. |
int |
getColumnWidth()
Returns the width of a table column, in pixels. |
int |
getColumnWidth(int column)
Returns the width, in pixels, of the cells in column. |
boolean |
getColumnWidthIsAdjusting(int column)
Determines the adjusting property for the specified column width. |
AbstractButton |
getCornerButton()
Returns the corner button. |
DataGridModel |
getDataGridModel()
Returns the DataGridModel for this datagrid. |
TableCellEditor |
getDefaultEditor(Class columnClass)
|
TableCellRenderer |
getDefaultRenderer(Class columnClass)
|
int |
getEditingStopBehavior()
Returns the editing stop behavior. |
Color |
getFillHandleColor()
Returns the fillHandleColor property. |
int |
getFreezeColumn()
Returns the freeze column. |
Color |
getFreezeLineColor()
Returns the freeze line color. |
int |
getFreezeRow()
Returns the freeze row. |
HyperlinkListener[] |
getHyperlinkListeners()
Returns an array of all the HyperLinkListeners added
to this JDataGrid with addHyperlinkListener(). |
Dimension |
getMaximumSize()
|
Dimension |
getMinimumSize()
|
Dimension |
getPreferredScrollableViewportSize()
|
Dimension |
getPreferredSize()
|
JLineBar |
getRowHeader()
Returns the row header for this table. |
Component |
getRowHeaderView()
Returns the row header view. |
int |
getRowHeaderWidth()
Returns the row header width. |
int |
getRowHeight(int row)
|
boolean |
getRowHeightIsAdjusting(int row)
Determines the adjusting property for the specified row height. |
SizeModel |
getRowSizeModel()
Returns the row size model. |
Cell |
getSelectedCell()
Returns the selected cell as Cell object. |
Cell[] |
getSelectedCells()
Returns all selected cells. |
Color |
getSelectionBorderColor()
Returns the selectionBorderColor property. |
List |
getSelectionList()
Returns the read-only selection list. |
String |
getToolTipText(MouseEvent event)
|
String |
getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component. |
UndoableEditListener[] |
getUndoableEditListeners()
Returns an array of all the undoable edit listeners registered on this data grid. |
double |
getZoomFactor()
Returns the zoom factor. |
protected void |
initializeLocalVars()
|
boolean |
isCellEditable(int row,
int column)
|
boolean |
isCellSelected(Cell c)
Returns whether the cell is selected. |
boolean |
isCellSelected(int row,
int column)
|
boolean |
isColumnSelected(int column)
|
boolean |
isColumnVisible(int column)
Returns the visible property for the specified column. |
boolean |
isEditable()
Returns true if the datagrid is editable. |
boolean |
isFillHandlePainted()
Returns the fillHandlePainted property. |
boolean |
isFullColumnSelected(int column)
Determines whether the full column is selected. |
boolean |
isFullRowSelected(int row)
Determines whether the full row is selected. |
boolean |
isPrinting()
Returns whether current is printing. |
boolean |
isRowSelected(int row)
|
boolean |
isRowVisible(int row)
Returns the visible property for the specified row. |
boolean |
isSelectionBorderPainted()
Returns the selectionBorderPainted property. |
boolean |
isSelectionEmpty()
Returns true if the selection is empty. |
protected void |
paintComponent(Graphics g)
|
protected String |
paramString()
Returns a string representation of this JDataGrid. |
Component |
prepareEditor(TableCellEditor editor,
int row,
int column)
|
Component |
prepareRenderer(TableCellRenderer renderer,
int row,
int column)
|
void |
print(Graphics g)
|
void |
printAll(Graphics g)
|
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
|
protected void |
processMouseEvent(MouseEvent e)
|
protected void |
processMouseMotionEvent(MouseEvent e)
|
protected void |
processMouseWheelEvent(MouseWheelEvent e)
|
void |
removeCellEditorListener(CellEditorListener l)
Removes a CellEditorListener from the listener list. |
void |
removeColumn(TableColumn aColumn)
|
void |
removeEditor()
|
void |
removeHyperlinkListener(HyperlinkListener listener)
Removes a hyperlink listener. |
void |
removeUndoableEditListener(UndoableEditListener l)
Unregisters the given observer from the notification list so it will no longer receive updates. |
void |
repaintCell(int rowIndex,
int columnIndex)
Repaints the specified cell. |
int |
rowAtPoint(Point point)
|
void |
scrollRectToVisible(Rectangle aRect)
|
void |
selectAll()
|
void |
selectCell(Cell c)
Selects the specified cell in the data grid. |
void |
selectCell(Cell c,
boolean includeSpan)
Selects the specified cell in the data grid. |
void |
selectCell(int row,
int column)
Selects the specified cell in the data grid. |
void |
selectCell(int row,
int column,
boolean includeSpan)
Selects the specified cell in the data grid. |
void |
selectCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
Selects the specified cell in the data grid. |
void |
selectCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn,
boolean includeSpan)
Selects the specified cell in the data grid. |
void |
selectColumn(int column)
Selects the specified column in the data grid. |
void |
selectColumn(int column,
boolean includeSpan)
Selects the specified column in the data grid. |
void |
selectRow(int row)
Selects the specified row in the data grid. |
void |
selectRow(int row,
boolean includeSpan)
Selects the specified row in the data grid. |
void |
setAlternatingRowBackground(Color color)
Sets the odd row background color. |
void |
setAlternatingRowForeground(Color color)
Sets the odd row foreground color. |
void |
setCellAttributes(AttributeSet attributes)
Sets attributes to all selected cell . |
void |
setCellAttributes(AttributeSet attributes,
int row,
int column)
Sets the cell attributes. |
void |
setCellClass(Class c,
int row,
int column)
Sets the cell class. |
void |
setCellEditorComponentTypeByClass(Class c,
CellEditorComponentType type)
Sets the cell editor component type for the specified class type. |
void |
setCellEditorComponentTypeByColumn(int column,
CellEditorComponentType type)
Sets the cell editor component type for the specified column. |
void |
setCellRendererComponentTypeByClass(Class c,
CellRendererComponentType type)
Sets the cell renderer component type for the specified class type. |
void |
setCellRendererComponentTypeByColumn(int column,
CellRendererComponentType type)
Sets the cell renderer component type for the specified column. |
void |
setCellSelectionModel(CellSelectionModel model)
Sets the cell selection model. |
void |
setCellSpanModel(CellSpanModel cellSpanModel)
Sets the cell span model. |
void |
setColumnHeaderHeight(int columnHeaderHeight)
Sets the column header height. |
void |
setColumnHeaderView(Component view)
Sets the column header view. |
void |
setColumnSizeModel(SizeModel columnSizeModel)
Sets the column size model. |
void |
setColumnVisible(int column,
boolean visible)
Shows or hides the specified column. |
void |
setColumnWidth(int columnWidth)
Sets the width, in pixels, of all cells to columnWidth,
revalidates, and repaints. |
void |
setColumnWidth(int column,
int columnWidth)
Sets the width for column to columnWidth,
revalidates, and repaints. |
void |
setColumnWidthIsAdjusting(int column,
boolean isAdjusting)
Sets the adjusting property for the specified column width. |
void |
setCornerButton(AbstractButton cornerButton)
Sets the corner button. |
void |
setEditable(boolean editable)
Sets the editable property, the default
value is true. |
void |
setEditingStopBehavior(int editingStopBehavior)
Sets the editing stop behavior. |
void |
setFillHandleColor(Color color)
Sets the fillHandleColor property. |
void |
setFillHandlePainted(boolean b)
Sets the fillHandlePainted property. |
void |
setFreezeCell(int row,
int column)
Sets the freeze cell. |
void |
setFreezeColumn(int column)
Sets the freeze column. |
void |
setFreezeLineColor(Color freezeLineColor)
Sets the freeze line color. |
void |
setFreezeRow(int row)
|
void |
setModel(TableModel dataModel)
|
void |
setRowHeader(JLineBar rowHeader)
Sets the row header for this table. |
void |
setRowHeaderView(Component view)
Sets the row header view. |
void |
setRowHeaderWidth(int rowHeaderWidth)
Sets the row header width. |
void |
setRowHeight(int rowHeight)
|
void |
setRowHeight(int row,
int rowHeight)
|
void |
setRowHeightIsAdjusting(int row,
boolean isAdjusting)
Sets the adjusting property for the specified row height. |
void |
setRowSizeModel(SizeModel rowSizeModel)
Sets the row size model. |
void |
setRowVisible(int row,
boolean visible)
Shows or hides the specified row. |
void |
setSelectionBorderColor(Color color)
Sets the selectionBorderColor property. |
void |
setSelectionBorderPainted(boolean b)
Sets the selectionBorderPainted property. |
void |
setZoomFactor(double zoomFactor)
Sets the zoom factor. |
void |
sizeColumnWidthToFit(int column)
Resizes the column width to fit the width of the column contents. |
void |
tableChanged(TableModelEvent e)
|
protected void |
unconfigureEnclosingScrollPane()
|
void |
undoableEditHappened(UndoableEditEvent e)
An undoable edit happened |
void |
updateUI()
Resets the UI property with a value from the current look and feel. |
void |
valueChanged(CellSelectionEvent e)
An cell selection event happened |
void |
valueChanged(ListSelectionEvent e)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int COMMIT
AbstractCellEditor.commitEdit should be invoked.
If in commiting the new value a ParseException is thrown,
the invalid value will remain, the editing cannot be stoped.
public static final int COMMIT_OR_REVERT
AbstractCellEditor.commitEdit should be invoked.
If in commiting the new value a ParseException is thrown,
the value will be reverted, the editing will be stoped.
public static final int COMMIT_OR_EDITING
AbstractCellEditor.commitEdit should be invoked.
If in commiting the new value a ParseException is thrown,
the value will be the current editing value, the editing will be stoped.
| Constructor Detail |
|---|
public JDataGrid()
JDataGrid that is initialized with a default
data model, a default column model, and a default selection
model.
JTable.createDefaultDataModel(),
JTable.createDefaultColumnModel(),
JTable.createDefaultSelectionModel()public JDataGrid(TableModel dm)
JDataGrid that is initialized with
dm as the data model, a default column model,
and a default selection model.
dm - the data model for the tableJTable.createDefaultColumnModel(),
JTable.createDefaultSelectionModel()
public JDataGrid(TableModel dm,
TableColumnModel cm)
JDataGrid that is initialized with
dm as the data model, cm
as the column model, and a default selection model.
dm - the data model for the tablecm - the column model for the tableJTable.createDefaultSelectionModel()
public JDataGrid(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
JDataGrid that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model.
If any of the parameters are null this method
will initialize the table with the corresponding default model.
The autoCreateColumnsFromModel flag is set to false
if cm is non-null, otherwise it is set to true
and the column model is populated with suitable
TableColumns for the columns in dm.
dm - the data model for the tablecm - the column model for the tablesm - the row selection model for the tableJTable.createDefaultDataModel(),
JTable.createDefaultColumnModel(),
JTable.createDefaultSelectionModel()
public JDataGrid(int numRows,
int numColumns)
JDataGrid with numRows
and numColumns of empty cells using
DefaultTableModel. The columns will have
names of the form "A", "B", "C", etc.
numRows - the number of rows the table holdsnumColumns - the number of columns the table holdsDefaultTableModel
public JDataGrid(Vector rowData,
Vector columnNames)
JDataGrid to display the values in the
Vector of Vectors, rowData,
with column names, columnNames. The
Vectors contained in rowData
should contain the values for that row. In other words,
the value of the cell at row 1, column 5 can be obtained
with the following code:
((Vector)rowData.elementAt(1)).elementAt(5);
rowData - the data for the new tablecolumnNames - names of each column
public JDataGrid(Object[][] rowData,
Object[] columnNames)
JDataGrid to display the values in the two dimensional array,
rowData, with column names, columnNames.
rowData is an array of rows, so the value of the cell at row 1,
column 5 can be obtained with the following code:
rowData[1][5];
All rows must be of the same length as columnNames.
rowData - the data for the new tablecolumnNames - names of each column| Method Detail |
|---|
public void updateUI()
updateUI in class JTableJComponent.updateUI()public String getUIClassID()
getUIClassID in class JTableJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)protected void initializeLocalVars()
initializeLocalVars in class JTableprotected void configureEnclosingScrollPane()
configureEnclosingScrollPane in class JTableprotected void unconfigureEnclosingScrollPane()
unconfigureEnclosingScrollPane in class JTablepublic int getColumnHeaderHeight()
public void setColumnHeaderHeight(int columnHeaderHeight)
public int getRowHeaderWidth()
public void setRowHeaderWidth(int rowHeaderWidth)
public void setRowHeight(int rowHeight)
setRowHeight in class JTable
public void setRowHeight(int row,
int rowHeight)
setRowHeight in class JTablepublic int getRowHeight(int row)
getRowHeight in class JTablepublic void sizeColumnWidthToFit(int column)
column - the columnpublic void setColumnWidth(int columnWidth)
columnWidth,
revalidates, and repaints.
The width of the cells will be equal to the column width minus
the column margin.
columnWidth - new column width
IllegalArgumentException - if columnWidth is
less than 1getColumnWidth()public int getColumnWidth()
setColumnWidth(int)
public void setColumnWidth(int column,
int columnWidth)
column to columnWidth,
revalidates, and repaints. The width of the cells in this column
will be equal to the column width minus the column margin.
column - the column whose width is being
changedcolumnWidth - new column width, in pixels
IllegalArgumentException - if columnWidth is
less than 1public int getColumnWidth(int column)
column.
column - the column whose width is to be returned
public int rowAtPoint(Point point)
rowAtPoint in class JTable
public void setColumnVisible(int column,
boolean visible)
column - the columnvisible - the visible propertyisColumnVisible(int)public boolean isColumnVisible(int column)
column - the column
setColumnVisible(int, boolean)
public void setRowVisible(int row,
boolean visible)
row - the rowvisible - the visible propertyisRowVisible(int)public boolean isRowVisible(int row)
row - the row
setRowVisible(int, boolean)
public void setColumnWidthIsAdjusting(int column,
boolean isAdjusting)
column - the column indexisAdjusting - the adjusting propertygetColumnWidthIsAdjusting(int)public boolean getColumnWidthIsAdjusting(int column)
column - the column index
setColumnWidthIsAdjusting(int, boolean)
public void setRowHeightIsAdjusting(int row,
boolean isAdjusting)
row - the row indexisAdjusting - the adjusting propertygetRowHeightIsAdjusting(int)public boolean getRowHeightIsAdjusting(int row)
row - the row index
setRowHeightIsAdjusting(int, boolean)public void setRowSizeModel(SizeModel rowSizeModel)
rowSizeModel - the row size modelgetRowSizeModel()public SizeModel getRowSizeModel()
setRowSizeModel(com.zfqjava.swing.SizeModel)protected SizeModel createRowSizeModel()
setRowSizeModel(com.zfqjava.swing.SizeModel),
getRowSizeModel()public void setColumnSizeModel(SizeModel columnSizeModel)
columnSizeModel - the column size modelgetColumnSizeModel()public SizeModel getColumnSizeModel()
setColumnSizeModel(com.zfqjava.swing.SizeModel)protected SizeModel createColumnSizeModel()
setColumnSizeModel(com.zfqjava.swing.SizeModel),
getColumnSizeModel()public CellSpanModel getCellSpanModel()
public void setCellSpanModel(CellSpanModel cellSpanModel)
cellSpanModel - the cell span modelprotected CellSpanModel createCellSpanModel()
public void cellMerged(CellSpanEvent e)
cellMerged in interface CellSpanListenerpublic void cellSplitted(CellSpanEvent e)
cellSplitted in interface CellSpanListener
public Rectangle getCellRect(int row,
int column,
boolean includeSpacing)
getCellRect in class JTable
public Rectangle getCellRect(int row,
int column,
boolean includeSpacing,
Rectangle rect)
public Rectangle getCellRect(int row,
int column,
boolean includeSpacing,
boolean includeSpan)
public Rectangle getCellRect(Cell c,
boolean includeSpacing)
c.
If includeSpacing is true then the value returned
has the full height and width of the row and column
specified. If it is false, the returned rectangle is inset by the
intercell spacing to return the true bounds of the rendering or
editing component as it will be set during rendering.
c - the cell areaincludeSpacing - if false, return the true cell bounds -
computed by subtracting the intercell
spacing from the height and widths of
the column and row models
cgetCellRect(int, int, boolean)
public Rectangle getCellRect(Cell c,
boolean includeSpacing,
Rectangle rect)
public void addColumn(TableColumn aColumn)
addColumn in class JTablepublic void removeColumn(TableColumn aColumn)
removeColumn in class JTablepublic void createDefaultColumnsFromModel()
createDefaultColumnsFromModel in class JTablepublic CellManager getCellManager()
public void setEditable(boolean editable)
editable property, the default
value is true.
editable - the editable propertyisEditable()public boolean isEditable()
setEditable(boolean)
public boolean isCellEditable(int row,
int column)
isCellEditable in class JTablepublic void setAlternatingRowBackground(Color color)
color - the odd row background colorgetAlternatingRowBackground()public Color getAlternatingRowBackground()
setAlternatingRowBackground(java.awt.Color)public void setAlternatingRowForeground(Color color)
color - the odd row foreground colorgetAlternatingRowForeground()public Color getAlternatingRowForeground()
setAlternatingRowForeground(java.awt.Color)protected void createDefaultRenderers()
createDefaultRenderers in class JTableprotected void createDefaultEditors()
createDefaultEditors in class JTablepublic TableCellRenderer getDefaultRenderer(Class columnClass)
getDefaultRenderer in class JTablepublic TableCellEditor getDefaultEditor(Class columnClass)
getDefaultEditor in class JTable
public TableCellRenderer getCellRenderer(int row,
int column)
getCellRenderer in class JTable
public Component prepareRenderer(TableCellRenderer renderer,
int row,
int column)
prepareRenderer in class JTable
public TableCellEditor getCellEditor(int row,
int column)
getCellEditor in class JTable
public Component prepareEditor(TableCellEditor editor,
int row,
int column)
prepareEditor in class JTable
public void setCellEditorComponentTypeByColumn(int column,
CellEditorComponentType type)
column - the specified column indextype - the cell editor component typepublic CellEditorComponentType getCellEditorComponentTypeByColumn(int column)
column - the specified object class
public void setCellEditorComponentTypeByClass(Class c,
CellEditorComponentType type)
c - the specified object classtype - the cell editor component typepublic CellEditorComponentType getCellEditorComponentTypeByClass(Class c)
c - the specified object class
public void setCellRendererComponentTypeByColumn(int column,
CellRendererComponentType type)
column - the specified column indextype - the cell renderer component typepublic CellRendererComponentType getCellRendererComponentTypeByColumn(int column)
column - the specified object class
public void setCellRendererComponentTypeByClass(Class c,
CellRendererComponentType type)
c - the specified object classtype - the cell renderer component typepublic CellRendererComponentType getCellRendererComponentTypeByClass(Class c)
c - the specified object class
public void printAll(Graphics g)
printAll in class JComponentpublic void print(Graphics g)
print in class JComponentpublic void setSelectionBorderColor(Color color)
selectionBorderColor property.
color - the selection border colorgetSelectionBorderColor()public Color getSelectionBorderColor()
selectionBorderColor property.
setSelectionBorderColor(java.awt.Color)public void setSelectionBorderPainted(boolean b)
selectionBorderPainted property.
b - the propertyisSelectionBorderPainted()public boolean isSelectionBorderPainted()
selectionBorderPainted property.
setSelectionBorderPainted(boolean)public void setFillHandleColor(Color color)
fillHandleColor property.
color - the fill handle colorgetFillHandleColor()public Color getFillHandleColor()
fillHandleColor property.
setFillHandleColor(java.awt.Color)public void setFillHandlePainted(boolean b)
fillHandlePainted property.
b - the propertyisFillHandlePainted()public boolean isFillHandlePainted()
fillHandlePainted property.
setFillHandlePainted(boolean)public boolean isPrinting()
public void setEditingStopBehavior(int editingStopBehavior)
One of 3 legal values:
editingStopBehavior - the editing stop behaviorgetEditingStopBehavior()public int getEditingStopBehavior()
One of 3 legal values:
setEditingStopBehavior(int)
public boolean editCellAt(int row,
int column,
EventObject e)
editCellAt in class JTable
protected boolean processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
processKeyBinding in class JTable
public Class getCellClass(int row,
int column)
row - the index of the rowcolumn - the index of the column
setCellClass(java.lang.Class, int, int)
public void setCellClass(Class c,
int row,
int column)
c - the class for the specified cellrow - the index of the rowcolumn - the index of the columngetCellClass(int, int)
public AttributeSet getCellAttributes(int row,
int column)
row - the index of the rowcolumn - the index of the column
setCellAttributes(javax.swing.text.AttributeSet, int, int)
public void setCellAttributes(AttributeSet attributes,
int row,
int column)
attributes - the cell attributesrow - the index of the rowcolumn - the index of the columngetCellAttributes(int, int)public AttributeSet getCellAttributes()
setCellAttributes(javax.swing.text.AttributeSet, int, int)public void setCellAttributes(AttributeSet attributes)
attributes - the cell attributesgetCellAttributes(int, int)public void removeEditor()
removeEditor in class JTablepublic void clearSelection()
clearSelection in class JTablepublic void selectAll()
selectAll in class JTablepublic boolean isFullRowSelected(int row)
row - the specified row
public boolean isFullColumnSelected(int column)
column - the specified column
public boolean isRowSelected(int row)
isRowSelected in class JTablepublic boolean isColumnSelected(int column)
isColumnSelected in class JTable
public boolean isCellSelected(int row,
int column)
isCellSelected in class JTablepublic boolean isCellSelected(Cell c)
c - the cell
public void valueChanged(ListSelectionEvent e)
valueChanged in interface ListSelectionListenervalueChanged in class JTablepublic void columnSelectionChanged(ListSelectionEvent e)
columnSelectionChanged in interface TableColumnModelListenercolumnSelectionChanged in class JTablepublic void setModel(TableModel dataModel)
setModel in class JTablepublic void tableChanged(TableModelEvent e)
tableChanged in interface TableModelListenertableChanged in class JTablepublic Cell getSelectedCell()
Cell object.
Returns null if have not such selected cell or the selected cell
is not contiguous.
Cell objectpublic Cell[] getSelectedCells()
Cell objectpublic boolean isSelectionEmpty()
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface ScrollablegetPreferredScrollableViewportSize in class JTablepublic void setRowHeader(JLineBar rowHeader)
rowHeader - the row headergetRowHeader()public JLineBar getRowHeader()
setRowHeader(com.zfqjava.swing.JLineBar)public void setColumnHeaderView(Component view)
view - the column header viewgetColumnHeaderView()public Component getColumnHeaderView()
setColumnHeaderView(java.awt.Component)public void setRowHeaderView(Component view)
view - the row header viewgetRowHeaderView()public Component getRowHeaderView()
setRowHeaderView(java.awt.Component)protected JLineBar createRowHeader()
setRowHeader(com.zfqjava.swing.JLineBar),
getRowHeader()public void setCornerButton(AbstractButton cornerButton)
cornerButton - the corner buttongetCornerButton()public AbstractButton getCornerButton()
setCornerButton(javax.swing.AbstractButton)protected AbstractButton createCornerButton()
setCornerButton(javax.swing.AbstractButton),
getCornerButton()public double getZoomFactor()
setZoomFactor(double)public void setZoomFactor(double zoomFactor)
zoomFactor - the zoom factorgetZoomFactor()protected void paintComponent(Graphics g)
paintComponent in class JComponentpublic void doLayout()
doLayout in class JTablepublic Dimension getMinimumSize()
getMinimumSize in class JComponentpublic Dimension getPreferredSize()
getPreferredSize in class JComponentpublic Dimension getMaximumSize()
getMaximumSize in class JComponentprotected void processMouseEvent(MouseEvent e)
processMouseEvent in class JComponentprotected void processMouseMotionEvent(MouseEvent e)
processMouseMotionEvent in class JComponentprotected void processMouseWheelEvent(MouseWheelEvent e)
processMouseWheelEvent in class Component
public void setFreezeCell(int row,
int column)
row - the top row visible in the bottom panecolumn - the left column visible in the right panesetFreezeRow(int),
getFreezeRow(),
setFreezeColumn(int),
getFreezeColumn()public void setFreezeRow(int row)
public int getFreezeRow()
setFreezeCell(int, int),
setFreezeRow(int)public void setFreezeColumn(int column)
column - the freeze column, the left column visible in the right panesetFreezeCell(int, int),
getFreezeColumn()public int getFreezeColumn()
setFreezeCell(int, int),
setFreezeColumn(int)public Color getFreezeLineColor()
setFreezeLineColor(java.awt.Color)public void setFreezeLineColor(Color freezeLineColor)
freezeLineColor - the freeze line colorgetFreezeLineColor()public void selectRow(int row)
row - the specified row
public void selectRow(int row,
boolean includeSpan)
row - the specified rowincludeSpan - if true, will select the cell area include all spanpublic void selectColumn(int column)
column - the specified column
public void selectColumn(int column,
boolean includeSpan)
column - the specified columnincludeSpan - if true, will select the cell area include all span
public void selectCell(int row,
int column)
row - the row indexcolumn - the column indexselectCell(int,int,int,int),
selectCell(Cell)
public void selectCell(int row,
int column,
boolean includeSpan)
row - the row indexcolumn - the column indexincludeSpan - if true, will select the cell area include all spanselectCell(int,int,int,int),
selectCell(Cell)public void selectCell(Cell c)
c - the specified cellselectCell(int,int),
selectCell(int,int,int,int)
public void selectCell(Cell c,
boolean includeSpan)
c - the specified cellincludeSpan - if true, will select the cell area include all spanselectCell(int,int),
selectCell(int,int,int,int)
public void selectCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
firstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell areaselectCell(int,int),
selectCell(Cell)
public void selectCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn,
boolean includeSpan)
firstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell areaincludeSpan - if true, will select the cell area include all spanselectCell(int,int),
selectCell(Cell)
public void changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
changeSelection in class JTable
public void changeSelection(int anchorRow,
int leadRow,
int anchorColumn,
int leadColumn,
boolean toggle,
boolean extend,
boolean includeSpan)
JDataGrid.
anchorRow - the anchor row index of the specified cell arealeadRow - the lead row index of the specified cell areaanchorColumn - the anchor column index of the specified cell arealeadColumn - the lead column index of the specified cell areatoggle - the toggle flagextend - the extend flagincludeSpan - if true, will select the cell area include all span
public void changeSelection(int firstRow,
int lastRow,
int firstColumn,
int lastColumn,
int anchorRow,
int leadRow,
int anchorColumn,
int leadColumn,
boolean toggle,
boolean extend,
boolean includeSpan)
JDataGrid.
firstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell areaanchorRow - the anchor row index of the specified cell arealeadRow - the lead row index of the specified cell areaanchorColumn - the anchor column index of the specified cell arealeadColumn - the lead column index of the specified cell areatoggle - the toggle flagextend - the extend flagincludeSpan - if true, will select the cell area include all spanpublic void scrollRectToVisible(Rectangle aRect)
scrollRectToVisible in class JComponentpublic DataGridModel getDataGridModel()
DataGridModel for this datagrid.
DataGridModel for this datagridpublic DataGridModel createDataGridModel()
DataGridModel for datagrid.
DataGridModel for datagridpublic List getSelectionList()
public void setCellSelectionModel(CellSelectionModel model)
model - the cell selection modelgetCellSelectionModel()public CellSelectionModel getCellSelectionModel()
setCellSelectionModel(com.zfqjava.swing.CellSelectionModel)protected CellSelectionModel createCellSelectionModel()
public void repaintCell(int rowIndex,
int columnIndex)
rowIndex - the row index of the specified cellcolumnIndex - the column index of the specified cellpublic void cellChanged(DataGridModelEvent e)
DataGridModel generates
a DataGridModelEvent.
Application code will not use these methods explicitly, they
are used internally by JDataGrid.
cellChanged in interface DataGridModelListenere - the eventpublic void undoableEditHappened(UndoableEditEvent e)
Application code will not use these methods explicitly, they
are used internally by JDataGrid.
undoableEditHappened in interface UndoableEditListenere - the undoable editprotected void fireUndoableEditHappened(UndoableEdit edit)
Application code will not use these methods explicitly, they
are used internally by JDataGrid.
edit - the undoable editEventListenerListpublic void addUndoableEditListener(UndoableEditListener l)
l - the observer to registerUndoableEditEventpublic void removeUndoableEditListener(UndoableEditListener l)
l - the observer to registerUndoableEditEventpublic UndoableEditListener[] getUndoableEditListeners()
UndoableEditListeners
or an empty array if no undoable edit listeners are
currently registeredaddUndoableEditListener(javax.swing.event.UndoableEditListener),
removeUndoableEditListener(javax.swing.event.UndoableEditListener)public void addHyperlinkListener(HyperlinkListener listener)
listener - the listenerpublic void removeHyperlinkListener(HyperlinkListener listener)
listener - the listenerpublic HyperlinkListener[] getHyperlinkListeners()
HyperLinkListeners added
to this JDataGrid with addHyperlinkListener().
HyperLinkListeners added or an empty
array if no listeners have been addedpublic void fireHyperlinkUpdate(HyperlinkEvent e)
e - the eventEventListenerListprotected void doHyperlinkUpdate(HyperlinkEvent e)
HyperlinkEvent, and do the default behavior, such as launch a browser.
e - the HyperlinkEventpublic String getToolTipText(MouseEvent event)
getToolTipText in class JTablepublic void valueChanged(CellSelectionEvent e)
Application code will not use these methods explicitly, they
are used internally by JDataGrid.
valueChanged in interface CellSelectionListenere - the cell selection eventpublic void addCellEditorListener(CellEditorListener l)
CellEditorListener to the listener list.
l - the new listener to be addedpublic void removeCellEditorListener(CellEditorListener l)
CellEditorListener from the listener list.
l - the listener to be removedpublic CellEditorListener[] getCellEditorListeners()
CellEditorListeners added
to this AbstractCellEditor with addCellEditorListener().
CellEditorListeners added or an empty
array if no listeners have been addedpublic void columnRemoved(TableColumnModelEvent e)
columnRemoved in interface TableColumnModelListenercolumnRemoved in class JTablepublic void columnMoved(TableColumnModelEvent e)
columnMoved in interface TableColumnModelListenercolumnMoved in class JTableprotected String paramString()
null.
paramString in class JTablepublic AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class JTable
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||