|
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 fireTableDataChanged()TableModel
interface. It takes care of the management of listeners and provides some conveniences for generatingTableModelEvents
and dispatching them to the listeners. To create a concreteTableModel
as asublcasssubclass 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.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.28 0238 12/0203/0001 @author Alan Chung @author Philip Milne
Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable
should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same. @see TableModelEvent @see EventListenerList @see javax.swing.JTable#tableChanged(TableModelEvent)
Class AbstractTableModel, EventListener[] getListeners(Class)Returns an array of all the objects currently registered asFooListener
s upon thisAbstractTableModel
.FooListener
s are registered using theaddFooListener
method.You can specify the
listenerslistenerType
argument with a class literal such asFooListener.class
. For example you can query a modelm
for its table modelofwith thegivenfollowingtypecode:thatTableModelListener[] tmls = (TableModelListener[])(m.getListeners(TableModelListener.class));
were added toIf no such listeners exist thismodelmethod returns an empty array. @returnsparamalllistenerType the type ofthelisteners requested; this parameter should specify an interface that descends fromjava.util.EventListener
@return an array of all objectsreceivingregistered asFooListener
s on this component or an empty array if no such listeners have been added @exception ClassCastException iflistenerType
notificationsdoesn'tfrom thisspecify amodelclass or interface that implementsjava.util.EventListener
@see #getTableModelListeners @since 1.3
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.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.25 0231 12/0203/0001 @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 releaseAs ofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder
Class DefaultTableCellRenderer, void setBackground(Color)Returns true ifOverridden for performancethis component is completely opaque. An opaque component paints every pixel within its rectangular boundsreasons.A non-opaque component paintsSeeonly a subset of its pixels or none at all allowingthepixels underneath it to "show through". Therefore aImplementationcomponentNotethat doesfor morenot fully paint its pixels provides a degree of transparency. Subclasses that guarantee to always completely paint their contents should override this method and return trueinformation.@return true if this component is completely opaque @see #setOpaque
Overrides JComponent.setForegroundsetBackground
to assign the unselected-background color to the specified color. @param c set the background color to this value
Class DefaultTableCellRenderer, void setValue(Object)Sets thestringString
object for the cell being rendered tovalue
. @param value the string value for this cell; if value isnull
it sets the text value to an empty string @see JLabel#setText
The standard column-handler for aClass DefaultTableColumnModel, int getColumnIndexAtX(int)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.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.35 0243 12/0203/0001 @author Alan Chung @author Philip Milne @see JTable
Returns the index of the column that lies at positionClass DefaultTableColumnModel, EventListener[] getListeners(Class)x
or -1 if no column covers this point. In keeping with Swing's separable model architecture a TableColumnModel does not know how the table columns actually appear on screen. The visual presentation of the columns is the responsibility of the view/controller object using this model (typically JTable). The view/controller need not display the columns sequentially from left to right. For example columns could be displayed from right to left to accomodate a locale preference or some columns might be hidden at the request of the user. Because the model does not know how the columns are laid out on screen the givenxPosition
should not be considered to be a coordinate in 2D graphics space. Instead it should be considered to be a width from the start of the first column in the model. If the column index for a given X coordinate in 2D space is requiredJTable.columnAtPoint
can be used instead. @param x the horizontal location of interest @return the index of the column or -1 if no column is found @see javax.swing.JTable#columnAtPoint
Returns an array of all the objects currently registered asFooListener
s upon this model.FooListener
s are registered using theaddFooListener
method.You can specify the
listenerslistenerType
argument with a class literal such asFooListener.class
. For example you can query aDefaultTableColumnModel
m
for its column modelofwith thegivenfollowingtypecode:thatColumnModelListener[] cmls = (ColumnModelListener[])(m.getListeners(ColumnModelListener.class));
were added toIf no such listeners exist thismodelmethod returns an empty array. @param listenerType thelistenertypeclassof listeners requested; this parameter should specify an interfacetothat descends frommatchjava.util.EventListener
@returnallan array oftheall objectsreceivingregistered as
listenerTypeFooListenernotificationssfromon this model or an empty array if no such listeners have been added @exception ClassCastException iflistenerType
doesn't specify a class or interface that implementsjava.util.EventListener
@see #getColumnModelListeners @since 1.3
This is an implementation ofClass DefaultTableModel, constructor DefaultTableModel(Object[], int)TableModel
that uses aVector
ofVectors
to store the cell value objects.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.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.27 0234 12/0203/00 @author Alan Chung01 @author Philip Milne @see TableModel @see #getDataVector
Constructs aClass DefaultTableModel, constructor DefaultTableModel(Vector, int)DefaultTableModel
with as many columns as there are elements incolumnNames
andof
numRowsrowCountnull
object values. Each column's name will be taken from thecolumnNames
array. @param columnNamesarray
containing the names of the new columns.;Ifif this isnull
then the model has no columns @paramnumRowsrowCount the number of rows the table holds @see #setDataVector @see #setValueAt
Constructs aClass DefaultTableModel, constructor DefaultTableModel(int, int)DefaultTableModel
with as many columns as there are elements incolumnNames
andof
numRowsrowCountnull
object values. Each column's name will be taken from thecolumnNames
vector. @param columnNamesvector
containing the names of the new columns.;Ifif this isnull
then the model has no columns @paramnumRowsrowCount the number of rows the table holds @see #setDataVector @see #setValueAt
Constructs aClass DefaultTableModel, void addColumn(Object)DefaultTableModel
withand
numRowsrowCountof
numColumnscolumnCountnull
object values. @paramnumRowsrowCount the number of rows the table holds @paramnumColumnscolumnCount the number of columns the table holds @see #setValueAt
Adds a column to the model. The new column will have the identifierClass DefaultTableModel, void addColumn(Object, Vector)columnName
which may be null. This method will send atableChanged
notification message to all the listeners. This method is a cover foraddColumn(Object Vector)
which usesnull
as the data vector. @param columnName the identifier of the column being added@exception IllegalArgumentException if columnName is null
Adds a column to the model. The new column will have the identifierClass DefaultTableModel, String getColumnName(int)columnName
which may be null.columnData
is the optional vector 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 is null
Returns the column name. @return a name for this column using the string value of the appropriate member inClass DefaultTableModel, void moveRow(int, int, int)columnIdentifiers
. IfcolumnIdentifiers
is null ordoes not have an entry for this index returns the default name provided by the superclass
Moves one or more rowsClass DefaultTableModel, void newRowsAdded(TableModelEvent)startingfromatthe inlcusive rangestart
toto the
startIndexendposition in the model.
endIndextotoAfter the move the row that was at indexstart
will be at index. This method will send a
toIndextotableChanged
notification message to all the listeners.
Examples of moves:@param1. moveRow(1 3 5); a|B|C|D|e|f|g|h|i|j|k - before a|e|f|g|h|B|C|D|
g|h|i|j|k - after2. 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
startIndexstart the starting row index to be moved @paramendIndexend the ending row index to be moved @paramtoIndexto the destination of the rows to be moved @exception ArrayIndexOutOfBoundsException if any of theindices areelementsout of range;wouldor ifbe movedendIndexoutis lessof thethantable'sstartIndexrange
Ensures that the new rows have the correct number of columns. This is accomplished by using theClass DefaultTableModel, void setDataVector(Object[][], Object[])setSize
method inVector
which truncates vectors which are too long and appendsnull
s if they are too short. This method also sends out atableChanged
notification message to all the listeners. @paramevente thisTableModelEvent
describes where the rows were added. Ifnull
it assumes all the rows were newly added @see #getDataVector
Replaces the value in theClass DefaultTableModel, void setDataVector(Vector, Vector)dataVector
instance variable with the values in the array. The first index in the
newDatadataVectorObject[][]
array is the row index and the second is the column index.are the names of the new columns. @param
columnNamescolumnIdentifiersnewDatadataVector the new data vector @paramcolumnNamescolumnIdentifiers the names of the columns @see #setDataVector(Vector Vector)
Replaces the currentdataVector
instance variable with the new Vector of rows.
newDatadataVectorare the names of the new columns. The first name in
columnNamescolumnIdentifiersis mapped to column 0 in
columnNamescolumnIdentifiers. Each row in
newDatadataVectoris adjusted to match the number of columns in
newDatadataVectoreither by truncating the
columnNamescolumnIdentifiersVector
if it is too long or addingnull
values if it is too short.Note that passing in a
null
value fordataVector
results in unspecified behavior an possibly an exception. @paramnewDatadataVector the new data vector @paramcolumnNamescolumnIdentifiers the names of the columns @see #newDataAvailable @see #getDataVector
This is the object which manages the header of theJTable
.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.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.55 0461 12/0603/0001 @author Alan Chung @author Philip Milne @see javax.swing.JTable
This class implements accessibility support for theJTableHeader
class. It provides an implementation of the Java Accessibility API appropriate to table header user-interface elements.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.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder
Invoked when a column is added to the table column model.Class JTableHeader, TableCellRenderer createDefaultRenderer()Application code will not use these methods explicitly they are used internally by
. @param e the event received @see TableColumnModelListener
JtableJTable
Returns a default renderer to be used when no header renderer is defined by aClass JTableHeader, TableColumn getResizingColumn()TableColumn
. @paramreturndefault renderer to be used when theretheis no headerdefault table column renderer
Returns the resizing column. If no column is being resized this method returnsClass JTableHeader, void setDefaultRenderer(TableCellRenderer)null
. @return the resizing column if a resize is in process otherwise returnsnull
Sets the default renderer to be used when noClass JTableHeader, void setDraggedColumn(TableColumn)headerRenderer
is defined by a. @param defaultRenderer the default renderer
TabelColumnTableColumn
Sets the header'sClass JTableHeader, void setResizingColumn(TableColumn)draggedColumn
toaColumn
.Application code will not use this method explicitly it is used internally by the column dragging mechanism. @param aColumn the
new value forcolumn being draggeddraggedColumnornull
if no column is being dragged
Sets the header'sresizingColumn
toaColumn
.Application code will not use this method explicitly it is used internally by the column sizing mechanism. @param aColumn the column being resized or
null
if no column is being resized
This interface defines the method any object that would like to be an editor of values for components such asJListBox
JComboBox
JTree
orJTable
needs to implement. @version 1.13 0214 12/0203/0001 @author Alan Chung
This interface defines the method required by any object that would like to be a renderer for cells in aJTable
. @version 1.15 0216 12/0203/0001 @author Alan Chung
AClass TableColumn, void sizeWidthToFit()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 theJTable
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
. ThemodelIndex
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 releaseAs ofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.49 0254 12/0203/0001 @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)
Resizes theClass TableColumn, Object identifierTableColumn
to fit the width of its header cell. This method does nothing if the header renderer isnull
(the default case). Otherwise it sets the minimum maximum and preferred widths of this column to the widths of the minimum maximum and preferred sizes of the Component delivered by the header renderer. The transient "width" property of this TableColumn is also set to the preferred width. Note this method is not used internally by the table package. @see #setPreferredWidth
This object is not used internally by the drawing machinery of theJTable
; identifiers may be set in theTableColumn
as as an optional way to tag and locate table columns. The table package does not modify or invoke any methods in theseidentiferidentifier objects other than theequals
method which is used in thegetColumnIndex()
method in theDefaultTableColumnModel
.
Defines the requirements for a table column model object suitable for use withClass TableColumnModel, int getColumnIndexAtX(int)JTable
. @version 1.20 0222 12/0203/0001 @author Alan Chung @author Philip Milne @see DefaultTableColumnModel
Returns the index of the column that lies on the horizontal pointxPosition
; or -1 if it lies outside the any of the column's bounds. In keeping with Swing's separable model architecture a TableColumnModel does not know how the table columns actually appear on screen. The visual presentation of the columns is the responsibility of the view/controller object using this model (typically JTable). The view/controller need not display the columns sequentially from left to right. For example columns could be displayed from right to left to accomodate a locale preference or some columns might be hidden at the request of the user. Because the model does not know how the columns are laid out on screen the givenxPosition
should not be considered to be a coordinate in 2D graphics space. Instead it should be considered to be a width from the start of the first column in the model. If the column index for a given X coordinate in 2D space is requiredJTable.columnAtPoint
can be used instead. @return the index of the column; or -1 if no column is found @see javax.swing.JTable#columnAtPoint
TheTableModel
interface specifies 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.
22 0223 12/0203/0001 @author Philip Milne @see JTable