|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagejavax.swing.table
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
This abstract class provides default implementations for most of the methods in theClass AbstractTableModel, void addTableModelListener(TableModelListener)TableModel
interface. It takes care of the management oflistnerslisteners and provides some conveniences for generatingTableModelEvents
and dispatching them to the listeners. To create a concreteTableModel
as a sublcass ofAbstractTableModel
you need only provide implementations for the following three methods:public int getRowCount(); public int getColumnCount(); public Object getValueAt(int row int column);Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.
23 0828 02/2802/9800 @author Alan Chung @author Philip Milne
Class AbstractTableModel, int findColumn(String)AddAdds a listener to the list that's notified each time a change to the data model occurs. @param l the TableModelListener
Class AbstractTableModel, void fireTableCellUpdated(int, int)ConvenienceReturnsmethod foralocating columns bycolumn given its name. Implementation is naive so this should be overridden if this method is to be called often. This method is not in theTableModel
interface and is not used by theJTable
. @param columnName string containing name of column to be located @return the column withcolumnName
or -1 if not found
Class AbstractTableModel, void fireTableChanged(TableModelEvent)NotifyNotifies all listeners that the value of the cell at([row column
has been updated. @param row row of cell which has been updated @param column column of cell which has been updated @see TableModelEvent @see EventListenerList)]
Class AbstractTableModel, void fireTableDataChanged()ForwardForwards the given notification event to allTableModelListeners
that registered themselves as listeners for this table model. @param e the event to be forwarded @see #addTableModelListener @see TableModelEvent @see EventListenerList
Class AbstractTableModel, void fireTableRowsDeleted(int, int)NotifyNotifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and theJTable
should redraw the table from scratch. The structure of the tableie.(as in the order of the columns) is assumed to be the same. @see TableModelEvent @see EventListenerList
Class AbstractTableModel, void fireTableRowsInserted(int, int)NotifyNotifies all listeners that rows in the(inclusive)range[firstRow lastRow]
inclusive have been deleted. @param firstRow the first row @param lastRow the last row @see TableModelEvent @see EventListenerList
Class AbstractTableModel, void fireTableRowsUpdated(int, int)NotifyNotifies all listeners that rows in the(inclusive)range[firstRow lastRow]
inclusive have been inserted. @param firstRow the first row @param lastRow the last row @see TableModelEvent @see EventListenerList
Class AbstractTableModel, void fireTableStructureChanged()NotifyNotifies all listeners that rows in the(inclusive)range[firstRow lastRow]
inclusive have been updated. @param firstRow the first row @param lastRow the last row @see TableModelEvent @see EventListenerList
Class AbstractTableModel, Class getColumnClass(int)NotifyNotifies all listeners that the table's structure has changed. The number of columns in the table and the names and types of the new columns may be different from the previous state. If theJTable
recievesreceives this event and itsautoCreateColumnsFromModel
flag is set it discards anyTableColumnstable columns that it had and reallocates defaultonescolumns in the order they appear in the model. This is the same as callingsetModel(TableModel)
on theJTable
. @see TableModelEvent @see EventListenerList
ReturnsClass AbstractTableModel, String getColumnName(int)Object.class
byregardlessdefaultofcolumnIndex
. @param columnIndex the column being queried @return the Object.class
Class AbstractTableModel, boolean isCellEditable(int, int)ReturnReturns a default name for the column using spreadsheet conventions: A B C ... Z AA AB etc. Ifcolumn
cannot be found returns an empty string. @param column the column being queried @return a string containing the default name ofcolumn
Returns false. ThisClass AbstractTableModel, void removeTableModelListener(TableModelListener)default implementation returns falseis the default implementation for all cells. @param rowIndex the row being queried @param columnIndex the column being queried @return false
Class AbstractTableModel, void setValueAt(Object, int, int)RemoveRemoves a listener from the list that's notified each time a change to the data model occurs. @param l the TableModelListener
This empty implementation is provided so users don't have to implement this method if their data model is not editable. @param aValue value to assign to cell @param rowIndex row of cell @param columnIndex column of cell
The standard class for rendering (displaying) individual cells in aJTable
.Implementation Note: This class inherits from
JLabel
a standard component class. HoweverJTable
employs a unique mechanism for rendering its cells and therefore requires some slightly modified behavior from its cell renderer. The table class defines a single cell renderer and uses it as a as a rubber-stamp for rendering all cells in the table; it renders the first cell changes the contents of that cell renderer shifts the origin to the new location re-draws it and so on. The standardJLabel
component was not designed to be used this way and we want to avoid triggering arevalidate
each time the cell is drawn. This would greatly decrease performance because therevalidate
message would be passed up the hierarchy of the container to determine whether any other components would be affected. So this class overrides thevalidate
revalidate
repaint
andfirePropertyChange
methods to be no-ops. If you write your own renderer please keep this performance consideration in mind.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.
15 0925 02/0102/9800 @author Philip Milne @see JTable
A subclass ofDefaultTableCellRenderer
that implementsUIResource
.DefaultTableCellRenderer
doesn't implementUIResource
directly so that applications can safely override thecellRenderer
property withDefaultTableCellRenderer
subclasses.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Class DefaultTableCellRenderer, void setBackground(Color)SupportOverridden fordeferredperformanceautomatic layout. Calls invalidate() and then adds this components validateRoot to a list of components that need to be validated. Validation will occur after all currently pending events have been dispatched. In other words after this method is called the first validateRoot (if any) found when walking up the containment hierarchy of this component will be validated. By default JRootPane JScrollPane and JTextField return true from isValidateRoot(). This method will automatically be called on this component when a property value changes such that size location or internal layout of this component has been affectedreasons.ThisSeeautomatic updating differs from the AWT because programs generally no longer need to invoke validate() to get the contents oftheGUI to update.Implementation@seeNotejava.awt.Component#invalidatefor@seemorejava.awtinformation.Container#validate @see #isValidateRoot @see RepaintManager#addInvalidComponent
OverridesClass DefaultTableCellRenderer, void setForeground(Color)JComponent.setForeground
tospecifyassign the unselected-background colorusingto the specified color. @param c set the background color to this value
OverridesClass DefaultTableCellRenderer, void updateUI()JComponent.setForeground
tospecifyassign the unselected-foreground colorusingto the specified color. @param c set the foreground color to this value
Notification from theClass DefaultTableCellRenderer, void validate()UIManager
that the look and feel [L&F] has changed. Replaces the current UI object with the latest version from theUIManager
. @see JComponent#updateUI
Validates this containerOverridden for performanceand all of its subcomponentsreasons.AWT uses validate to cause a container to laySeeout its subcomponents again afterthecomponents it containsImplementationhaveNotebeen addedfor moreto or modifiedinformation.@see #validate @see Component#invalidate
The standard column-handler for aClass DefaultTableColumnModel, void addColumn(TableColumn)JTable
.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.
26 1035 02/2102/9800 @author Alan Chung @author Philip Milne @see JTable
AppendsClass DefaultTableColumnModel, TableColumn getColumn(int)aColumn
to the end of thereceiver'stableColumns
array. This method also posts thecolumnAdded
event to its listeners. @param column()ThetheTableColumn to be added @exception IllegalArgumentException if
aColumn
isnull
@see #removeColumn
Returns theClass DefaultTableColumnModel, int getColumnCount()TableColumn
object for the column atcolumnIndex
. @return the TableColumn object forparam columnIndex the index of the columnat columnIndexdesired @param columnIndexreturn theindexTableColumn
ofobject for the columndesiredatcolumnIndex
Returns the number of columns in theClass DefaultTableColumnModel, int getColumnIndex(Object)receiver'stableColumns
table columnsarray. @return the number of columns in thereceiver's table columnstableColumns
array @see #getColumns
Returns the index of the first column in theClass DefaultTableColumnModel, int getColumnIndexAtX(int)receiver's columnstableColumns
array whose identifier is equal toidentifier
when compared usingequals
. @param identifier the identifier object @return the index of the first()tablecolumn in thereceiver'stableColumns
array whose identifier is equal toidentifier when compared using equals(). @param identifier theidentifier
object@exception IllegalArgumentException ifidentifier
isnull
or if noTableColumn
has thisidentifier
@see #getColumn
Returns the index of the column that liesClass DefaultTableColumnModel, int getColumnMargin()on theat positionxPositionx
or -1 ifit lies outside theno column covers thisanypoint.of@param x thecolumn'shorizontalbounds.location of interest @return the index of the column or -1 if no column is found
Returns the width margin forClass DefaultTableColumnModel, Enumeration getColumns()TableColumn
. The defaultcolumnMargin
is 1. @return the maximum width for theTableColumn
@see #setColumnMargin.
Returns anClass DefaultTableColumnModel, ListSelectionModel getSelectionModel()Enumeration
of all the columns in the model. @return anEnumeration
of the columns in the model
Returns theClass DefaultTableColumnModel, void moveColumn(int, int)ListSelectionModel
that is used to maintain column selection state. @return the object that provides column selection state. Ornull
if row selection is not allowed. @see #setSelectionModel()
Moves the column and heading atClass DefaultTableColumnModel, void removeColumn(TableColumn)columnIndex
tonewIndex
. The old column atcolumnIndex
will now be found atnewIndex
. The column that used to be atnewIndex
is shifted left or right to make room. This will not move any columns ifcolumnIndex
equalsnewIndex
. This method also poststheacolumnMoved
event to its listeners. @param columnIndex the index of column to be moved @param newIndex()Newnew index to move the column @exception IllegalArgumentException ifcolumn
ornewIndex
are not in the valid range
Deletes theClass DefaultTableColumnModel, void setColumnMargin(int)TableColumncolumn
from thereceiver's table columnstableColumns
array. This method will do nothing ifcolumn
is not in the table's columns list.tile
is called to resize both the header and table views. This method also posts()theacolumnRemoved
event to its listeners. @param column()ThetheTableColumn to be removed @see #addColumn
Sets the column margin toClass DefaultTableColumnModel, void setSelectionModel(ListSelectionModel)newMargin
. This method also poststheacolumnMarginChanged
event to its listeners. @param newMargin the()widthnew marginofwidththe columnin pixels @see #getColumnMargin @see #getTotalColumnWidth
Sets the selection model for thisTableColumnModel
tonewModel
and registerswithforlistnerlistener notifications from the new selection model. IfnewModel
isnull
it meanscolumns are not selectablean exception is thrown. @param newModel the new selection model @exception IllegalArgumentException ifnewModel
isnull
@see #getSelectionModel
This is an implementation ofClass DefaultTableModel, constructor DefaultTableModel()TableModel
that uses aVector
ofVectors
to store the cell value objects.
Note: The DefaultTableModel's API contains the methods addColumn() removeColumn() but not methods to insert a column at an index nor methods to move the columns. This is because JTable does not display the columns based on the order of the columns in this model. So rearranging them here doesn't do much. See the column ordering methods in TableColumnModel.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.19 0827 02/2802/9800 @author Alan Chung @author Philip Milne @see TableModel @see #getDataVector
Constructs a default DefaultTableModel
which is a table of zero columns and zero rows.
Class DefaultTableModel, constructor DefaultTableModel(Object[], int)Constructs aClass DefaultTableModel, constructor DefaultTableModel(Object[][], Object[])DefaultTableModel
with as many columns as there are elements incolumnNames
andnumRows
ofnull
object values. Each column's name will be taken from thecolumnNames
array. @param columnNamesArrayarray
containing the names of the new columns. If this isnull then the model has no columns @param numRows
Thethe number of rows the table holds @see #setDataVector @see #setValueAt
Constructs aClass DefaultTableModel, constructor DefaultTableModel(Vector, Vector)DefaultTableModel
and initializes the table by passingdata
andcolumnNames
to thesetDataVector
method. The first index in the()Object[][]
array is the row index and the second is the column index. @param dataThethe data of the table @param columnNamesThethe names of the columns.@see #getDataVector @see #setDataVector
Constructs aClass DefaultTableModel, constructor DefaultTableModel(Vector, int)DefaultTableModel
and initializes the table by passingdata
andcolumnNames
to thesetDataVector
method. @param data()Thethe data of the table @param columnNamesVectorvector
containing the names of the new columns.@see #getDataVector @see #setDataVector
Constructs aClass DefaultTableModel, constructor DefaultTableModel(int, int)DefaultTableModel
with as many columns as there are elements incolumnNames
andnumRows
ofnull
object values. Each column's name will be taken from thecolumnNames
vector. @param columnNamesVectorvector
containing the names of the new columns. If this isnull then the model has no columns @param numRows
Thethe number of rows the table holds @see #setDataVector @see #setValueAt
Constructs aClass DefaultTableModel, void addColumn(Object)DefaultTableModel
withnumRows
andnumColumns
ofnull
object values. @param numRowsThethe number of rows the table holds @param numColumnsThethe number of columns the table holds @see #setValueAt
Class DefaultTableModel, void addColumn(Object, Object[])AddAdds a column to the model. The new column will have theidenitifieridentifiercolumnName
. This method will send atableChanged
notification message to all the listeners. This method is a cover for()addColumn(Object Vector)
which usesnull
as the data vector. @param columnName the identifier of the column being added @exception IllegalArgumentException ifcolumnName
isnull
Adds a column to the model.Class DefaultTableModel, void addColumn(Object, Vector)withThe new columnnamewill have the identifiercolumnName.
columnData
is the optional array of data for the column. If it isnull
the column is filled withnull
values. Otherwise the new data will be added to model starting with the first element going to row 0 etc. This method will send atableChanged
notification message to all the listeners. @see #addColumn(Object Vector)
Class DefaultTableModel, void addRow(Object[])AddAdds a column to the model. The new column will have theidenitifieridentifiercolumnName
.columnData
is the optionalVectorvector of data for the column. If it isnull
the column is filled withnull
values. Otherwise the new data will be added to model starting with the first element going to row 0 etc. This method will send atableChanged
notification message to all the listeners. @param columnName the identifier of the column being added @param columnData optional data of the column being added @exception IllegalArgumentException if()columnName
isnull
Class DefaultTableModel, void addRow(Vector)AddAdds a row to the end of the model. The new row will containnull
values unlessrowData
is specified. Notification of the row being added will be generated. @param rowData optional data of the row being added
Class DefaultTableModel, Vector convertToVector(Object[])AddAdds a row to the end of the model. The new row will containnull
values unlessrowData
is specified. Notification of the row being added will be generated. @param rowData optional data of the row being added
Returns aClass DefaultTableModel, Vector convertToVector(Object[][])Vectorvector that contains the same objects as the array. @param anArray the array to be converted @return the new vector; ifanArray
isnull
returnsnull
Returns aClass DefaultTableModel, String getColumnName(int)Vectorvector ofVectorsvectors that contains the same objects as the array. @param anArray the double array to be converted @return the new vector of vectors; ifanArray
isnull
returnsnull
Returns the column name. @return a name for this column using the string value of the appropriate member inClass DefaultTableModel, Vector getDataVector()columnIdentfierscolumnIdentifiers
. IfcolumnIdentfierscolumnIdentifiers
isnull
or does not haveandan entry for this indexreturnreturns the default name provided by the superclass.
Class DefaultTableModel, Object getValueAt(int, int)ThisReturnsreturnstheVector
ofVectors
that contains the table's data values. The vectors contained in the outer vector are each a single row of values. In other words to get to the cell at row 1 column 5:
((Vector)getDataVector().elementAt(1)).elementAt(5);
You can directly alter the returned Vector. You can change the cell values the number of rows. If you need to alter@return thenumbervector ofcolumns in the model you can do so with addColumn() removeColumn() or the setDataVector() methods. Once you have finished modifying the dataVector you must inform the modelvectorsofcontaining thenewtables datausing one of the notification methods. The notification methods will generate the appropriate TableModelListener messages to notify the JTable and any other listeners of this model.values @see #newDataAvailable @see #newRowsAdded @see #setDataVector
Returns an attribute value for the cell atClass DefaultTableModel, void insertRow(int, Object[])row
andcolumn
. @param row the row whose value is to belookedqueriedup@param column the column whose value is to belooked upqueried @return the value Object at the specified cell @exception ArrayIndexOutOfBoundsException if an invalid row or column was given.
Class DefaultTableModel, void insertRow(int, Vector)InsertInserts a row atrow
in the model. The new row will containnull
values unlessrowData
is specified. Notification of the row being added will be generated. @param row the row index of the row to be inserted @param rowData optional data of the row being added @exception ArrayIndexOutOfBoundsException if the row was invalid.
Class DefaultTableModel, boolean isCellEditable(int, int)InsertInserts a row atrow
in the model. The new row will containnull
values unlessrowData
is specified. Notification of the row being added will be generated. @param row the row index of the row to be inserted @param rowData optional data of the row being added @exception ArrayIndexOutOfBoundsException if the row was invalid.
Returns trueClass DefaultTableModel, void moveRow(int, int, int)ifregardlessthe cell at row and column is editable. Otherwise the setValueAt() on the cell will not change the valueofthat cellparameter values. @param row the row whose value is to belooked upqueried @param column the column whose value is to belookedqueriedup@return trueif the cell is editable.@see #setValueAt
Moves one or more rows starting atClass DefaultTableModel, void newDataAvailable(TableModelEvent)startIndex
toendIndex
in the model to thetoIndex
. This method will send atableChanged
notification message to all the listeners.()
Examples of moves:@param startIndex the starting row index to be moved @param endIndex the ending row index to be moved @param toIndex the destination of the rows to be moved @exception ArrayIndexOutOfBoundsException if any of the indices are out of range1. moveRow(1 3 5);
a|B|C|D|e|f|g|h|i|j|k - before a|e|f|B|C|D|g|h|i|j|k - after
2. moveRow(6 7 1);
a|b|c|d|e|f|G|H|i|j|k - before a|G|H|b|c|d|e|f|i|j|k - after
. Or; or ifendIndex
is less thanstartIndex
.
Equivalent to fireTableChanged
. @param event the change event
Class DefaultTableModel, void newRowsAdded(TableModelEvent)Class DefaultTableModel, void removeRow(int)This method will makeEnsuressurethat the new rows have the correct number of columns.ItThis isdoes soaccomplished by using thesetSize
method inVector
which truncatesVectorsvectors which are too long and appendsnullsnull
s if they are too short. This method also sends out atableChanged
notification message to all the listeners. @()parameterparam eventThisthisTableModelEvent
describes where the rows were added. Ifnull
it assumes all the rows were newly added.@see #getDataVector
Class DefaultTableModel, void rowsRemoved(TableModelEvent)RemoveRemoves the row atrow
from the model. Notification of the row being removed will be sent to all the listeners. @param row the row index of the row to be removed @exception ArrayIndexOutOfBoundsException if the row was invalid.
Equivalent to fireTableChanged()
. @param event the change event
Class DefaultTableModel, void setColumnIdentifiers(Object[])Replaces the column identifiers in the model. If the number ofClass DefaultTableModel, void setColumnIdentifiers(Vector)newIdentifiersnewIdentifier
s is greater than the currentnumColumnsnumber of columns new columns are added to the end of each row in the model. If the number ofnewIdentifier
s is less than the current number of columns all the extra columns at the end of a row are discarded.@param newIdentifiers
Arrayarray of column identifiers.AIfnull
meanssettingset the model to zero columns @see #setNumRows
Replaces the column identifiers in the model. If the number ofClass DefaultTableModel, void setDataVector(Object[][], Object[])newIdentifier
s is greater than the current number of columns new columns are added to the end of each row in the model. If the number ofnewIdentifier
s is less than the current number of columns all the extra columns at the end of a row are discarded.@param newIdentifiers
Vectorvector of column identifiers.AIfnull
meanssettingset the model to zero columns @see #setNumRows
Class DefaultTableModel, void setDataVector(Vector, Vector)ThisReplacesreplacesthe value in thedataVector
instance variable with the values in the arraynewData
. The first index in theObject[][]
array is the row index and the second is the column index.columnNames
are the names of the new columns. @param newData the new data vector @param columnNames the names of the columns @see #setDataVector(Vector Vector)
Class DefaultTableModel, void setNumRows(int)ThisReplacesreplacesthe currentdataVector
instance variable with the new Vector of rowsnewData
.columnNames
are the names of the new columns. The first name incolumnNames
is mapped to column 0 innewData
. Each row innewData
is adjusted to match the number of columns incolumnNames
either by truncating theVector
if it is too long or addingnull
values if it is too short.@param newData
Thethe new data vector @param columnNamesThethe names of the columns @see #newDataAvailable @see #getDataVector
Class DefaultTableModel, void setValueAt(Object, int, int)Sets theObsolete asnumberofrows in the modelJava 2 platform v1.If the new size is greater than the current size new rows are added to the end of the model If the new size is less than the current size all rows at index newSize and greater are discarded3.@param newSizePleasetheusenewsetRowCount
number of rows @see #setColumnIdentifiersinstead.
Sets the object value for the cell atClass DefaultTableModel, Vector columnIdentifierscolumn
androw
.aValue
is the new value. This method will generate atableChanged
notification. @param aValue the new value(). This; this can be null.@param row the row whose value is to be changed @param column the column whose value is to be changed @exception ArrayIndexOutOfBoundsException if an invalid row or column was given.
The Vector
of column identifiers.
Class DefaultTableModel, Vector dataVectorTheVector
ofVectorVectors
ofObject
values.
This is thecolumnobjectheader part of a JTable. Iwhichallowmanages theuser to change column widths and column ordering. Iheadershareof thesame TableColumnModel with aJTable
.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.
36 1054 03/0815/9800 @author Alan Chung @author Philip Milne @see javax.swing.JTable
TheThis classusedimplementstoaccessibility supportobtainfor theaccessibleJTableHeader
class. Itrole forprovides anthisimplementation of the Java Accessibility API appropriate to table header user-interfaceobjectelements.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Get the AccessibleContext associated with this@returnobject. In theAccessibleContextimplementation of the Java Accessibility API for this class returns this object which serves as its own AccessibleContext. @return thisJComponentobject
Constructs aClass JTableHeader, constructor JTableHeader(TableColumnModel)JTableHeader
with a defaultTableColumnModel
. @see #createDefaultColumnModel()
Constructs aClass JTableHeader, int columnAtPoint(Point)JTableHeader
which is initialized withcm
as the column model. Ifcm
isnull
this method will initialize the table header with a defaultTableColumnModel
. @param cmThethe column model for the table @see #createDefaultColumnModel()
Returns the index of the column thatClass JTableHeader, TableColumnModel createDefaultColumnModel()point
lies in or -1 if it liesoutsideoutthe receiver'sof bounds. @return the index of the column thatpoint
lies in or -1 if it liesoutsideoutthe receiver'sof bounds
Returns the default column model object which is aClass JTableHeader, AccessibleContext getAccessibleContext()DefaultTableColumnModel
.SubclassA subclass can override this method to return a different column model object @return the default column model object
Class JTableHeader, TableColumnModel getColumnModel()GetGets the AccessibleContext associated with thisJComponentJTableHeader. For JTableHeaders the AccessibleContext takes the form of an AccessibleJTableHeader. A new AccessibleJTableHeader instance is created if necessary. @return an AccessibleJTableHeader that serves as the AccessibleContext of thisJComponentJTableHeader
Returns theClass JTableHeader, TableColumn getDraggedColumn()TableColumnModel
that contains all columninforamtioninformation of this table header. @return theobjectcolumnModel
that provides the column state of the tableproperty @see #setColumnModel()
Returns the the dragged column if and only if a drag is in process otherwise returnsClass JTableHeader, int getDraggedDistance()null
. @return thethedragged column ifand only ifa drag is in process otherwise returnsnull
@see #getDraggedDistance.
Returns the column's horizontal distance from its original position if and only if a drag is in process. Otherwise the the return value is meaningless. @return the column's horizontal distance from its original position ifClass JTableHeader, Rectangle getHeaderRect(int)and only ifa drag is in process otherwise the return value is meaningless @see #getDraggedColumn
Returns the rectangle containing the header tile atClass JTableHeader, boolean getReorderingAllowed()columnIndexcolumn
. When thecolumn
parameter is out of bounds this method uses the same conventions as theJTable
methodgetCellRect
. @return the rectangle containing the header tile atcolumnIndexcolumn
@exception IllegalArgumentException If columnIndex is out ofseerangeJTable#getCellRect
Returns true if theClass JTableHeader, boolean getResizingAllowed()receiver allowsuserthe useris allowed to rearrange columns by dragging their headers false otherwise. The default is true. You can rearrange columns programmatically regardless of this setting. @returntrue if the receiver allowstheuser to rearrange columns by dragging their headers falsereorderingAllowed
otherwiseproperty @see #setReorderingAllowed
Returns true if theClass JTableHeader, TableColumn getResizingColumn()receiver allowsuserthe useris allowed to resize columns by dragging between their headers false otherwise. The default is true. You can resize columns programmatically regardless of this setting. @returntrue ifthereceiver allows the user to resize columns by dragging betweenresizingAllowed
their headers false otherwise.property @see #setResizingAllowed
Returns the resizing column. If no column is being resized this method returns null
. @return the resizing column
Class JTableHeader, JTable getTable()Returns the table associated with this headerClass JTableHeader, String getToolTipText(MouseEvent)'s. @returnpartnerthetable
property
Class JTableHeader, TableHeaderUI getUI()OverridingAllowsto allowthe renderer's tips to be used ifit hasthere is text set. @param event the location of the event identifies the proper renderer and therefore the proper tip @return the tool tip for this component
Returns the look and feel (L&F) object that renders this component. @return the TableHeaderUI
object that renders this component
Class JTableHeader, String getUIClassID()Returns the suffix used to construct the name of the look and feel (L&F) classClass JTableHeader, boolean getUpdateTableInRealTime()thatused torendersrender this component. @return the string "TableHeaderUI" @return "TableHeaderUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JTableHeader, String paramString()Returns trueObsolete asif the receiver updates the bodyofthe table view in real time when a column isJavaresized or dragged2 platform v1.User can set this flag to false to3.speed up theReal time repaintstable'sin response touser resizecolumn dragging ordrag actions. Theresizingdefault is trueare now unconditional.@return true if the table updates in real time @see #setUpdateTableInRealTime
Returns a string representation of thisClass JTableHeader, void resizeAndRepaint()JTableHeader
. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not benull
.Overriding
paramString
to provide information about the specific new aspects of the JFC components. @return a string representation of this()JTableHeader
.
Class JTableHeader, void setColumnModel(TableColumnModel)ProperlySizessizesthereceiver and itsheaderviewand marks it as needing display.Also resets cursor rectangles forEquivalentthe header view and linetoscrollrevalidate
amountsfollowedfor thebyJScrollPanerepaint
.
Sets the column model for this table toClass JTableHeader, void setDraggedColumn(TableColumn)newModel
and registerswithforlistnerlistener notifications from the new column model. @paramnewModelcolumnModel the new data source for this table @exception IllegalArgumentException ifnewModel
isnull
@see #getColumnModel()@beaninfo bound: true description: The object governing the way columns appear in the view.
Sets the header'sClass JTableHeader, void setDraggedDistance(int)draggedColumn
toaColumn
@param aColumn the new value for draggedColumn
Sets the header'sClass JTableHeader, void setReorderingAllowed(boolean)draggedDistance
todistance
. @param distance the distance dragged
Sets whether the user can drag column headers to reorder columns. @paramClass JTableHeader, void setResizingAllowed(boolean)flagreorderingAllowed true if the table view should allow reordering; otherwise false @see #getReorderingAllowed @beaninfo bound: true description: Whether the user can drag column headers to reorder columns.
Sets whether the user can resize columns by dragging between headers. @paramClass JTableHeader, void setResizingColumn(TableColumn)flagresizingAllowed true if table view should allow resizing @see #getResizingAllowed @beaninfo bound: true description: Whether the user can resize columns by dragging between headers.
Sets the header'sClass JTableHeader, void setTable(JTable)resizingColumn
toaColumn
. @param aColumn the column being resized
Sets the table associated with this headerClass JTableHeader, void setUI(TableHeaderUI)'s. @param table thepartnernew tableto@beaninfoaTablebound: true description: The table associated with this header.
Sets the look and feel (L&F) object that renders this component. @param ui the TableHeaderUI
L&F object @see UIDefaults#getUI
Class JTableHeader, void setUpdateTableInRealTime(boolean)Class JTableHeader, void updateUI()Sets whetherObsolete asthe bodyofthe table updates in real time when a column isJavaresized or dragged2 platform v1.@param flag true if3.tableView should update the body of the table in real timeReal time repaints in response to column dragging or resizing are@seenow#getUpdateTableInRealTimeunconditional.
Notification from theClass JTableHeader, TableColumnModel columnModelUIManager
that the look and feel (L&F) has changed. Replaces the current UI object with the latest version from theUIManager
. @see JComponent#updateUI
The TableColumnModel
of the table header.
Class JTableHeader, TableColumn draggedColumnThe index of the column being dragged.Class JTableHeader, int draggedDistance0null
if not dragging.
The distance from its original position the column has been dragged.Class JTableHeader, boolean reorderingAllowed
Class JTableHeader, boolean resizingAllowedReorderingIf true reordering of columns are allowed by the user; the default is true.
Class JTableHeader, TableColumn resizingColumnResizingIf true resizing of columns are allowed by the user; the default is true.
The index of the column being resized.Class JTableHeader, boolean updateTableInRealTime0null
if not resizing.
IfObsoletethis flagasis true then theof Java 2 platformheaderv1.3.will repaint the table as aReal time repaints in response to columnisdraggingdraggedorresizedresizing are now unconditional.
This interface defines theClass TableCellEditor, Component getTableCellEditorComponent(JTable, Object, boolean, int, int)methodsmethod any object that would like to be an editor of values for components such asListBoxJListBox
JComboBox
JTree
ComboBoxorTreeJTable
or Table etcneeds to implement. @version 1.10130802/2602/9800 @author Alan Chung
Sets an initialvalue
for the editor. This will cause the editor tostopEditing
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. @param table theJTable
that is asking the editor to edit;This parametercan benull
@param value the value of the cell to be edited..;Itit is up to the specific editor to interpret and draw the value.eg.For example if value is theStringstring "true" it could be rendered as a string or it could be rendered as a check box that is checked.null
is a valid value.@param isSelected trueisif the cell is to berendererrendered withselectionhighlighting @param row the row of the cell being edited @param column the column of the cell being edited @return the component for editing
This interface defines theClass TableCellRenderer, Component getTableCellRendererComponent(JTable, Object, boolean, boolean, int, int)methodsmethod required by any object that would like to be a renderer forcellcells in aJTable
. @version 1.11 0815 02/2602/9800 @author Alan Chung
This method is sent toReturns the component used for drawing therenderercell.by the drawing tableThis method is used to configure the renderer appropriately before drawing.Return the Component used for drawing.@param table theJTable
that is asking the renderer to draw. This;parametercan benull
@param value the value of the cell to be rendered. It is up to the specific renderer to interpret and draw the value..eg.For example ifvalue
is theStringstring "true" it could be rendered as a string or it could be rendered as a check box that is checked.null
is a valid value.@param isSelected trueisif the cell is to berendererrendered with the selectionhighlightinghighlighted; otherwise false @param hasFocus 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 editing @param row the row index of the cell being drawn. When drawing the header therowIndexvalue ofrow
is -1.@param column the column index of the cell being drawn
AClass TableColumn, constructor TableColumn()TableColumn
represents all the attributes of a column in aJTable
such as width resizibility minimum and maximum width. In addition theTableColumn
provides slots for a renderer and an editor that can be used to display and edit the values in this column.It is also possible to specify renderers and editors on a per type basis rather than a per column basis - see the
setDefaultRenderer
method in the(Class)JTable
class. This default mechanism is only used when the renderer (or editor) in theTableColumn
isnull
.The
TableColumn
stores the link between the columns in theJTable
and the columns in theTableModel
.This theThemodelIndex
is the column in theTableModel
which will be queried for the data values for the cells in this column. As the column moves around in the view thismodelIndex
does not change.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.
34 1049 02/2102/9800 @author Alan Chung @author Philip Milne @see javax.swing.table.TableColumnModel @see javax.swing.table.DefaultTableColumnModel @see javax.swing.table.JTableHeader#getDefaultRenderer() @see JTable#getDefaultRenderer(Class) @see JTable#getDefaultEditor(Class) @see JTable#getCellRenderer(int int) @see JTable#getCellEditor(int int)
Cover method using a default model index of 0 default width of 75 aClass TableColumn, constructor TableColumn(int)null
renderer and anull
editor. Thismethodsmethod is intended for serialization. @see #TableColumn(int int TableCellRenderer TableCellEditor)
Cover method using a default width of 75 aClass TableColumn, constructor TableColumn(int, int)null
renderer and anull
editor. @see #TableColumn(int int TableCellRenderer TableCellEditor)
Cover method using aClass TableColumn, constructor TableColumn(int, int, TableCellRenderer, TableCellEditor)null
renderer and anull
editor. @see #TableColumn(int int TableCellRenderer TableCellEditor)
Creates and initializes an instance ofClass TableColumn, void addPropertyChangeListener(PropertyChangeListener)TableColumn
withmodelIndex
. AllTableColumn
constructors delegate to this one. ThemodelIndex
is the index of the column in the model which will supply the data for this column in the table. ThemodelIndex
does not change as the columns are reordered in the view. The width parameter is used to set both thepreferredWidth
for this column and theintialinitial width. The renderer and editor are the objects usedrepsectivelyrespectively to render and edit values in this column. When these arenull
default values provided by thegetDefaultRenderer
and(Class)getDefaultEditor
methods in the(Class)JTable
class are used to provide defaults based on the type of the data in this column. This column-centric rendering strategy can be circumvented by overriding thegetCellRenderer
methods in the()JTable
.@
param modelIndex the column in the model which provides the values for this column @see JTable#getDefaultRenderer(Class) @see JTable#getDefaultEditor(Class) @see JTable#getCellRenderer(int int) @see JTable#getCellEditor(int int)
Class TableColumn, void disableResizedPosting()AddAdds aPropertyChangeListener
to the listener list. The listener is registered for all properties.A
PropertyChangeEvent
will get fired in response to an explicit call tosetFont
setBackground
orSetForegroundsetForeground
on the current component. Note that if the current component is inheriting its foreground background or font from its container then no event will be fired in response to a change in the inherited property. @param listenerThe PropertyChangeListenerthe listener to be added
Class TableColumn, void enableResizedPosting()Turns offThis fieldlistener-notificationswaswould otherwise occur when a column isnot used in previous releases and thereresizedare currently no plans to support it in the future. @deprecated as of Java 2 platform v1.3
Class TableColumn, TableCellEditor getCellEditor()Turns onThis fieldlistener-notificationswasso that listenersnot used in previous releases and there areoncecurrently no plans to support it in the future.again@deprecatedinformed when a column is resizedas of Java 2 platform v1.3
Returns theClass TableColumn, TableCellRenderer getCellRenderer()TableCellEditor
used by theJTable
todrawedit values for this column.The cellEditor of the column not only controls the visual look for the column but is also used to interpret the value object supplied by the TableModel.When thecellEditor
isnull
theJTable
uses a default editor based on the class of the cells in that column. The default value for acellEditor
isnull
. @return theTableCellEditor used by the JTable to draw values for thiscellEditor
columnproperty @see #setCellEditor @see JTable#setDefaultEditor
Returns theClass TableColumn, TableCellRenderer getHeaderRenderer()TableCellRenderer
used by theJTable
to draw values for this column. ThecellRenderer
of the column not only controls the visual look for the column but is also used to interpret the value object supplied by theTableModel
. When thecellRenderer
isnull
theJTable
uses a default renderer based on the class of the cells in that column. The default value for acellRenderer
isnull
. @return theTableCellRenderer used by the JTable to draw values for thiscellRenderer
columnproperty @see #setCellRenderer @see JTable#setDefaultRenderer
Returns theClass TableColumn, Object getHeaderValue()TableCellRenderer
used to draw the header of theTableColumn
.The defaultWhenheadertherendererheaderRenderer
isanull
JCellRenderertheinitializedJTableHeader
with auses itsJLabeldefaultRenderer
.@returnThethedefaultTableCellRenderervalueused tofor adrawheaderRenderer
isnull
. @return theheaderheaderRenderer
property @see #setHeaderRenderer @see #setHeaderValue @see javax.swing.table.JTableHeader#getDefaultRenderer()
Returns theClass TableColumn, Object getIdentifier()Object
used as the value for the header renderer. @return theObject used as the value for the headerheaderValue
rendererproperty @see #setHeaderValue
Returns theClass TableColumn, int getMaxWidth()identifier
object for this column. Note identifiers are not used bytheJTable
they are purely a convenience for external use. If theidentifier
isnull
getIdentifier()
returnsgetHeaderValue
as a default. @return the()idenitifer object for thisidentifier
columnproperty @see #setIdentifier
Returns the maximum width for theClass TableColumn, int getMinWidth()TableColumn
. TheTableColumn
's width can't be made larger than this either by the user or programmatically. The default maxWidth is Integer.MAX_VALUE. @return themaximum width for themaxWidth
TableColumn.property @see #setMaxWidth
Returns the minimum width for theClass TableColumn, int getModelIndex()TableColumn
. TheTableColumn
's width can't be made less than this either by the user or programmatically. The default minWidth is 15. @return theminimum width for theminWidth
TableColumnproperty @see #setMinWidth
Class TableColumn, int getPreferredWidth()GetsReturns the model index for this column. @return themodelIndex
property
Returns the preferred width of theClass TableColumn, boolean getResizable()TableColumn
. The default preferred width is 75. @return thewidth ofpreferredWidth
the TableColumnproperty @see #setPreferredWidth
Returns true if the user is allowed to resize theClass TableColumn, int getWidth()TableColumn
's width false otherwise. You can change the width programmatically regardless of this setting. The default is true. @returntrue if the user is allowed to resizetheTableColumn width falseisResizable
otherwise.property @see #setResizable
Returns the width of theClass TableColumn, void removePropertyChangeListener(PropertyChangeListener)TableColumn
. The default width is 75. @return thewidth
of the TableColumnproperty @see #setWidth
Class TableColumn, void setCellEditor(TableCellEditor)RemoveRemoves aPropertyChangeListener
from the listener list.ThisTheremovesPropertyChangeListener
a PropertyChangeListener thatto be removed was registered for all properties. @param listenerThethePropertyChangeListenerlistener to be removed
Sets theClass TableColumn, void setCellRenderer(TableCellRenderer)TableCellEditoreditor to used byJTable to drawwhenindividual values fora cell in this columntoisanEditoredited. @paramanEditorcellEditor the newdata cell editorcellEditor @see #getCellEditor @beaninfo bound: true description: The editor to use for cell values.
Sets theClass TableColumn, void setHeaderRenderer(TableCellRenderer)TableCellRenderer
used byJTable
to draw individual values for this columnto aRenderer.Posts a@parambound property change notificationcellRenderer the new cellRendererwith@seethe#getCellRenderername@beaninfoCELL_RENDERER_PROPERTY.bound:@paramtrueaRendererdescription:the new data cell rendererThe renderer to use for@seecell#getCellRenderervalues.
Sets theClass TableColumn, void setHeaderValue(Object)TableCellRenderer
used to draw theTableColumn
's header toaRendererheaderRenderer
.Posts a bound property change notification@paramwithheaderRenderer thenamenewHEADER_RENDERER_PROPERTY.headerRenderer @exception IllegalArgumentException if aRenderer isseenull.#getHeaderRenderer @parambeaninfoaRendererbound:thetruenewdescription: The header renderer@see #getHeaderRenderer.
Sets theClass TableColumn, void setIdentifier(Object)Object
whose string representation will be used as the value for theheaderRenderer
.Posts aWhen theboundTableColumn
property change notification withis created the defaulttheheaderValue
nameisHEADER_VALUE_PROPERTYnull
. @paramaValueheaderValue the newheader valueheaderValue @see #getHeaderValue @beaninfo bound: true description: The text to be used by the header renderer.
Sets theClass TableColumn, void setMaxWidth(int)TableColumn
's identifier toanIdentifier
.Note: identifiers are not used by the
JTable
they are purely a convenience for the external tagging and location of columns. @paramanIdentifieridentifier an identifier for this column @see #getIdentifier @beaninfo bound: true description: A unique identifier for this column.
Sets theClass TableColumn, void setMinWidth(int)TableColumn
's maximum width tonewMaxWidthmaxWidth
; alsoadjustingadjusts thecurrentwidth and preferred width ifit'sthey are greater than this value. @paramnewMaxWidthmaxWidth the new maximum widthvalue@see #getMaxWidth @see #setPreferredWidth @see #setMinWidth @beaninfo bound: true description: The maximum width of the column.
Sets theClass TableColumn, void setModelIndex(int)TableColumn
's minimum width tonewMinWidthminWidth
; alsoadjustingadjusts the current width and preferred width ifit'sthey are less than this value. @paramnewMinWidthminWidth the new minimum widthvalue@see #getMinWidth @see #setPreferredWidth @see #setMaxWidth @beaninfo bound: true description: The minimum width of the column.
Sets the model index for this column. The model index is the index of the column in the model that will be displayed by thisClass TableColumn, void setPreferredWidth(int)TableColumn
. As theTableColumn
is moved around in the view the model index remains constant. @param modelIndex the new modelIndex @beaninfo bound: true description: The model index.
Sets this column's preferred width toClass TableColumn, void setResizable(boolean)preferredWidth
. IfpreferredWidth
exceeds the minimum or maximum width it'sis adjusted to the appropriate limiting value.For details on how the widths of columns in the
JTable
(andJTableHeader
) are calculated from thepreferredWidth
see thesizeColumnsToFit
method in(int)theJTable
. @param preferredWidthThethe new preferred width.@see #getPreferredWidth @see JTable#sizeColumnsToFit(int) @beaninfo bound: true description: The preferred width of the column.
Sets whetherClass TableColumn, void setWidth(int)the userthis column canresize the receiver inbeits JTableViewresized. @paramflagisResizable if trueif theresizing iscolumnallowed;isResizableotherwise false @see #getResizable @beaninfo bound: true description: Whether or not this column can be resized.
This method should not be used to set the widths of columns in theClass TableColumn, void sizeWidthToFit()JTable
-usesetPreferredWidth
instead. Like a layout manager in the AWT the()JTable
adjusts a column's width automatically whenever the table itself changes size or a column's preferred width is changed. Setting widths programmatically therefore has no long term effect.This
methodsmethod sets this column's width tonewWidthwidth
. IfnewWidthwidth
exceeds the minimum or maximum width it'sis adjusted to the appropriate limiting value.Posts a bound property change notification with the name COLUMN_WIDTH_PROPERTY.@param
newWidth Thewidth the new widthvalue@see #getWidth @see #setMinWidth @see #setMaxWidth @see #setPreferredWidth @see JTable#sizeColumnsToFit(int) @beaninfo bound: true description: The width of the column.
Resizes theClass TableColumn, String CELL_RENDERER_PROPERTYTableColumn
to fit the width of its header cell.IfThisthe maximum width is less than the width of the header the maximum is increased to the header'smethodwidth.doesSimilarlynothing if theminimum width is greater than the width of theheaderthe minimumrenderer isreduced tonull
(theheader'sdefaultwidthcase). @see #setPreferredWidth
Class TableColumn, String COLUMN_WIDTH_PROPERTYBound propertyObsolete asnameof Java 2 platform v1.3. Please use string literals to identify properties.
Class TableColumn, String HEADER_RENDERER_PROPERTYBound propertyObsolete asnameof Java 2 platform v1.3. Please use string literals to identify properties.
Class TableColumn, String HEADER_VALUE_PROPERTYBound propertyObsolete asnameof Java 2 platform v1.3. Please use string literals to identify properties.
Class TableColumn, TableCellEditor cellEditorBound propertyObsolete asnameof Java 2 platform v1.3. Please use string literals to identify properties.
The editor used to edit the data cells of the column.Class TableColumn, TableCellRenderer cellRenderer
The renderer used to draw the data cells of the column.Class TableColumn, TableCellRenderer headerRenderer
The renderer used to draw the header of the column.Class TableColumn, Object headerValue
The header value of the column.Class TableColumn, Object identifier
This object is not used internally by the drawing machinery of theClass TableColumn, boolean isResizableJTable
;.Identifiersidentifiers may be set in theTableColumn
as as an optional way to tag and locateTableColumnstable columns. The table package does not modify or invoke any methods in these identifer objects other than theequals
method which is used in thegetColumnIndex()
method in theDefaultTableColumnModel
.
Class TableColumn, int maxWidthResizableIfflagtrue the user is allowed to resize the column; the default is true.
The maximum width of the column.Class TableColumn, int minWidth
The minimum width of the column.Class TableColumn, int modelIndex
The index of the column in the model which is to be displayed by thisClass TableColumn, int resizedPostingDisableCountTableColumn
. As columns are moved around in the viewthe model indexmodelIndex
remains constant.
Class TableColumn, int widthCounterThis field was not usedto disable postingin previous releasesofand there are currently noresizingplansnotificationsto supportuntilit in theendfuture. @deprecated as oftheJava 2 platformresizev1.3
The width of the column.
Defines the requirements for a table column model object suitable for use withClass TableColumnModel, void addColumn(TableColumn)JTable
. @version 1.16 0820 02/2602/9800 @author Alan Chung @author Philip Milne @see DefaultTableColumnModel
AppendsClass TableColumnModel, void addColumnModelListener(TableColumnModelListener)aColumn
to the end of thereceiver'stableColumns
array. This methodalsopoststheacolumnAdded
event to its listeners. @param aColumn()ThetheTableColumn to be added @see #removeColumn
Class TableColumnModel, TableColumn getColumn(int)AddAdds a listener for table column model events. @param x aTableColumnModelListener
object
Returns theClass TableColumnModel, int getColumnCount()TableColumn
object for the column atcolumnIndex
. @return the TableColumn object forparam columnIndex the index of thecolumn atdesiredcolumnIndexcolumn @param columnIndexreturn theindexTableColumn
ofobject for the columndesiredatcolumnIndex
Returns the number of columns in the model. @return the number of columns in the modelClass TableColumnModel, int getColumnIndex(Object)
Returns the index of the first column in theClass TableColumnModel, int getColumnIndexAtX(int)receiver's columns arraytable whose identifier is equal toidentifier
when compared usingequals
. @param columnIdentifier the identifier object @return the index of the first table column()in the receiver's tableColumns arraywhose identifier is equal toidentifier
@exception IllegalArgumentException ifwhen compared using equals(). @param identifier the identifier objectidentifier
isnull
or noTableColumn
has thisidentifier
@see #getColumn
Returns the index of the column that lies on the horizontal point
xPosition; or -1 if it lies outside the any of the column's bounds. @return the index of the column; or -1 if no column is found
Class TableColumnModel, int getColumnMargin()Returns the widthClass TableColumnModel, boolean getColumnSelectionAllowed()marginbetween the cells in each column. @return the margin in pixels between the cells
Returns true if columnsClass TableColumnModel, Enumeration getColumns()canmay be selected. @return true if columnscanmay be selected @see #setColumnSelectionAllowed
Returns anClass TableColumnModel, int getSelectedColumnCount()Enumeration
of all the columns in the model. @return anEnumeration
of all the columns in the model
Returns the number of selected columns. @return the number of selected columns; or 0 if no columns are selectedClass TableColumnModel, int[] getSelectedColumns()
Returns an array ofClass TableColumnModel, ListSelectionModel getSelectionModel()indexesindiciesforof all selected columns. @return an array ofints givingintegers containing theindexesindicies of all selected columns; or an emptyintarray ifno columnnothing is selected.
Returns the current selection model. @return aClass TableColumnModel, int getTotalColumnWidth()ListSelectionModel
objectrepresenting the selection model val@see #setSelectionModel
Returns the total width of all the columns. @return the total computed width of all columnsClass TableColumnModel, void moveColumn(int, int)
Moves the column andClass TableColumnModel, void removeColumn(TableColumn)headingits header atcolumnIndex
tonewIndex
. The old column atcolumnIndex
will now be found atnewIndex
. The column that used to be atnewIndex
is shifted left or right to make room. This will not move any columns ifcolumnIndex
equalsnewIndex
. This methodalsopoststheacolumnMoved
event to its listeners. @param columnIndex the index of column to be moved @param newIndex()Newindexto moveof the column's new location @exception IllegalArgumentException ifcolumncolumnIndex
ornewIndex
are not in the valid range
Deletes theClass TableColumnModel, void removeColumnModelListener(TableColumnModelListener)TableColumn
column
from thereceiver's table columnstableColumns
array. This method will do nothing ifcolumn
is not in the table'scolumnscolumn list. This methodalsopoststheacolumnRemoved
event to its listeners. @param column()ThetheTableColumn to be removed @see #addColumn
Class TableColumnModel, void setColumnMargin(int)RemoveRemoves a listener for table column model events. @param x aTableColumnModelListener
object
Sets theClass TableColumnModel, void setColumnSelectionAllowed(boolean)TableColumn
's column margin tonewMargin
. This methodalsopoststheacolumnMarginChanged
event to its listeners. @param newMargin the width()marginin pixels of the new column margins @see #getColumnMargin
Sets whether the columns in this modelClass TableColumnModel, void setSelectionModel(ListSelectionModel)canmay be selected. @param flag true if columns may be selected; otherwise false @see #getColumnSelectionAllowed
Sets the selection modelwhich handles selections. @param newModel aListSelectionModel
object @see #getSelectionModel
TheClass TableModel, void addTableModelListener(TableModelListener)TableModel
interfaceispecifiesspecifies the methods theJTable
will use to interrogate a tabular data model.The
JTable
can be set up to display any data model which implements theTableModel
interface with a couple of lines of code:
TableModel myData = new MyTableModel(); JTable table = new JTable(myData);For further documentation see Creating a Table Model in The Java Tutorial.
@version 1.
15 0822 02/2602/9800 @author Philip Milne @author Alan Chung @see JTable@see AbstractTableModel
Class TableModel, Class getColumnClass(int)AddAdds a listener to the list that'sis notified each time a change to the data model occurs. @param l the TableModelListener
Returns theClass TableModel, int getColumnCount()lowestmostcommonspecific superclass for alldenominatorthe cellClassvalues in the column. This is used by thetableJTable
to set up a default renderer and editor for the column. @param columnIndex the index of the column @return the common ancestor class of the object values in the model.
Returns the number of columnsClass TableModel, String getColumnName(int)managed byin thedata source objectmodel. AJTable
uses this method to determine how many columns it should create and displayon initializationby default. @return the numberorof columns in the model @see #getRowCount
Returns the name of the column atClass TableModel, int getRowCount()columnIndex
. This is used to initialize the table's column header name. Note: this name does not need to be unique. Two; two columnsonin a table can have the same name. @param columnIndex the index of the column @return the name of the column
Returns the number ofClass TableModel, Object getValueAt(int, int)records managedrowsbyin thedata source objectmodel. AJTable
uses this method to determine how many rows it shouldcreate anddisplay. This method should be quick as it iscall bycalledJTablefrequentlyquite frequentlyduring rendering. @return the numberorof rows in the model @see #getColumnCount
ReturnsClass TableModel, boolean isCellEditable(int, int)an attributethe value for the cell atcolumnIndex
androwIndex
. @param rowIndex the row whose value is to belookedqueriedup@param columnIndex the column whose value is to belooked upqueried @return the value Object at the specified cell
Returns true if the cell atClass TableModel, void removeTableModelListener(TableModelListener)rowIndex
andcolumnIndex
is editable. OtherwisesetValueAt
on the cell will not change the value of that cell. @param rowIndex the row whose value()isto belookedqueriedup@param columnIndex the column whose valueisto belooked upqueried @return true if the cell is editable.@see #setValueAt
Class TableModel, void setValueAt(Object, int, int)RemoveRemoves a listener from the list that'sis notified each time a change to the data model occurs. @param l the TableModelListener
Setsan attribute value fortherecordvalue in the cell atcolumnIndex
androwIndex
. aValueis the newtovalueaValue
. @param aValue the new value @param rowIndex the row whose value is to be changed @param columnIndex the column whose value is to be changed @see #getValueAt @see #isCellEditable