jdk/src/share/classes/javax/swing/JTable.java

Print this page

        

*** 20,40 **** * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.util.*; import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.awt.print.*; ! import java.beans.*; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; import java.io.InvalidObjectException; --- 20,42 ---- * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.swing; import java.util.*; import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.awt.print.*; ! import java.beans.JavaBean; ! import java.beans.BeanProperty; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; import java.io.InvalidObjectException;
*** 50,59 **** --- 52,62 ---- import java.text.DateFormat; import java.text.MessageFormat; import javax.print.attribute.*; import javax.print.PrintService; + import sun.reflect.misc.ReflectUtil; import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*;
*** 202,225 **** * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * - * - * @beaninfo - * attribute: isContainer false - * description: A component which displays data in a two dimensional grid. - * * @author Philip Milne * @author Shannon Hickey (printing support) * @see javax.swing.table.DefaultTableModel * @see javax.swing.table.TableRowSorter * @since 1.2 */ /* The first versions of the JTable, contained in Swing-0.1 through * Swing-0.4, were written by Alan Chung. */ @SuppressWarnings("serial") // Same-version serialization only public class JTable extends JComponent implements TableModelListener, Scrollable, TableColumnModelListener, ListSelectionListener, CellEditorListener, Accessible, RowSorterListener { --- 205,225 ---- * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Philip Milne * @author Shannon Hickey (printing support) * @see javax.swing.table.DefaultTableModel * @see javax.swing.table.TableRowSorter * @since 1.2 */ /* The first versions of the JTable, contained in Swing-0.1 through * Swing-0.4, were written by Alan Chung. */ + @JavaBean(defaultProperty = "UI", description = "A component which displays data in a two dimensional grid.") + @SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JTable extends JComponent implements TableModelListener, Scrollable, TableColumnModelListener, ListSelectionListener, CellEditorListener, Accessible, RowSorterListener {
*** 888,901 **** * Sets the <code>tableHeader</code> working with this <code>JTable</code> to <code>newHeader</code>. * It is legal to have a <code>null</code> <code>tableHeader</code>. * * @param tableHeader new tableHeader * @see #getTableHeader - * @beaninfo - * bound: true - * description: The JTableHeader instance which renders the column headers. */ public void setTableHeader(JTableHeader tableHeader) { if (this.tableHeader != tableHeader) { JTableHeader old = this.tableHeader; // Release the old header if (old != null) { --- 888,900 ---- * Sets the <code>tableHeader</code> working with this <code>JTable</code> to <code>newHeader</code>. * It is legal to have a <code>null</code> <code>tableHeader</code>. * * @param tableHeader new tableHeader * @see #getTableHeader */ + @BeanProperty(description + = "The JTableHeader instance which renders the column headers.") public void setTableHeader(JTableHeader tableHeader) { if (this.tableHeader != tableHeader) { JTableHeader old = this.tableHeader; // Release the old header if (old != null) {
*** 927,940 **** * * @param rowHeight new row height * @exception IllegalArgumentException if <code>rowHeight</code> is * less than 1 * @see #getRowHeight - * @beaninfo - * bound: true - * description: The height of the specified row. */ public void setRowHeight(int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); } int old = this.rowHeight; --- 926,938 ---- * * @param rowHeight new row height * @exception IllegalArgumentException if <code>rowHeight</code> is * less than 1 * @see #getRowHeight */ + @BeanProperty(description + = "The height of the specified row.") public void setRowHeight(int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); } int old = this.rowHeight;
*** 973,987 **** * @param row the row whose height is being changed * @param rowHeight new row height, in pixels * @exception IllegalArgumentException if <code>rowHeight</code> is * less than 1 - * @beaninfo - * bound: true - * description: The height in pixels of the cells in <code>row</code> * @since 1.3 */ public void setRowHeight(int row, int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); } getRowModel().setSize(row, rowHeight); --- 971,984 ---- * @param row the row whose height is being changed * @param rowHeight new row height, in pixels * @exception IllegalArgumentException if <code>rowHeight</code> is * less than 1 * @since 1.3 */ + @BeanProperty(description + = "The height in pixels of the cells in <code>row</code>") public void setRowHeight(int row, int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); } getRowModel().setSize(row, rowHeight);
*** 1004,1017 **** /** * Sets the amount of empty space between cells in adjacent rows. * * @param rowMargin the number of pixels between cells in a row * @see #getRowMargin - * @beaninfo - * bound: true - * description: The amount of space between cells. */ public void setRowMargin(int rowMargin) { int old = this.rowMargin; this.rowMargin = rowMargin; resizeAndRepaint(); firePropertyChange("rowMargin", old, rowMargin); --- 1001,1013 ---- /** * Sets the amount of empty space between cells in adjacent rows. * * @param rowMargin the number of pixels between cells in a row * @see #getRowMargin */ + @BeanProperty(description + = "The amount of space between cells.") public void setRowMargin(int rowMargin) { int old = this.rowMargin; this.rowMargin = rowMargin; resizeAndRepaint(); firePropertyChange("rowMargin", old, rowMargin);
*** 1035,1048 **** * * @param intercellSpacing a <code>Dimension</code> * specifying the new width * and height between cells * @see #getIntercellSpacing - * @beaninfo - * description: The spacing between the cells, - * drawn in the background color of the JTable. */ public void setIntercellSpacing(Dimension intercellSpacing) { // Set the rowMargin here and columnMargin in the TableColumnModel setRowMargin(intercellSpacing.height); getColumnModel().setColumnMargin(intercellSpacing.width); --- 1031,1043 ---- * * @param intercellSpacing a <code>Dimension</code> * specifying the new width * and height between cells * @see #getIntercellSpacing */ + @BeanProperty(bound = false, description + = "The spacing between the cells, drawn in the background color of the JTable.") public void setIntercellSpacing(Dimension intercellSpacing) { // Set the rowMargin here and columnMargin in the TableColumnModel setRowMargin(intercellSpacing.height); getColumnModel().setColumnMargin(intercellSpacing.width);
*** 1065,1078 **** * The default color is look and feel dependent. * * @param gridColor the new color of the grid lines * @exception IllegalArgumentException if <code>gridColor</code> is <code>null</code> * @see #getGridColor - * @beaninfo - * bound: true - * description: The grid color. */ public void setGridColor(Color gridColor) { if (gridColor == null) { throw new IllegalArgumentException("New color is null"); } Color old = this.gridColor; --- 1060,1072 ---- * The default color is look and feel dependent. * * @param gridColor the new color of the grid lines * @exception IllegalArgumentException if <code>gridColor</code> is <code>null</code> * @see #getGridColor */ + @BeanProperty(description + = "The grid color.") public void setGridColor(Color gridColor) { if (gridColor == null) { throw new IllegalArgumentException("New color is null"); } Color old = this.gridColor;
*** 1102,1114 **** * * @param showGrid true if table view should draw grid lines * * @see #setShowVerticalLines * @see #setShowHorizontalLines - * @beaninfo - * description: The color used to draw the grid lines. */ public void setShowGrid(boolean showGrid) { setShowHorizontalLines(showGrid); setShowVerticalLines(showGrid); // Redraw --- 1096,1108 ---- * * @param showGrid true if table view should draw grid lines * * @see #setShowVerticalLines * @see #setShowHorizontalLines */ + @BeanProperty(description + = "The color used to draw the grid lines.") public void setShowGrid(boolean showGrid) { setShowHorizontalLines(showGrid); setShowVerticalLines(showGrid); // Redraw
*** 1121,1134 **** * * @param showHorizontalLines true if table view should draw horizontal lines * @see #getShowHorizontalLines * @see #setShowGrid * @see #setShowVerticalLines - * @beaninfo - * bound: true - * description: Whether horizontal lines should be drawn in between the cells. */ public void setShowHorizontalLines(boolean showHorizontalLines) { boolean old = this.showHorizontalLines; this.showHorizontalLines = showHorizontalLines; firePropertyChange("showHorizontalLines", old, showHorizontalLines); --- 1115,1127 ---- * * @param showHorizontalLines true if table view should draw horizontal lines * @see #getShowHorizontalLines * @see #setShowGrid * @see #setShowVerticalLines */ + @BeanProperty(description + = "Whether horizontal lines should be drawn in between the cells.") public void setShowHorizontalLines(boolean showHorizontalLines) { boolean old = this.showHorizontalLines; this.showHorizontalLines = showHorizontalLines; firePropertyChange("showHorizontalLines", old, showHorizontalLines);
*** 1142,1155 **** * * @param showVerticalLines true if table view should draw vertical lines * @see #getShowVerticalLines * @see #setShowGrid * @see #setShowHorizontalLines - * @beaninfo - * bound: true - * description: Whether vertical lines should be drawn in between the cells. */ public void setShowVerticalLines(boolean showVerticalLines) { boolean old = this.showVerticalLines; this.showVerticalLines = showVerticalLines; firePropertyChange("showVerticalLines", old, showVerticalLines); // Redraw --- 1135,1147 ---- * * @param showVerticalLines true if table view should draw vertical lines * @see #getShowVerticalLines * @see #setShowGrid * @see #setShowHorizontalLines */ + @BeanProperty(description + = "Whether vertical lines should be drawn in between the cells.") public void setShowVerticalLines(boolean showVerticalLines) { boolean old = this.showVerticalLines; this.showVerticalLines = showVerticalLines; firePropertyChange("showVerticalLines", old, showVerticalLines); // Redraw
*** 1192,1210 **** * AUTO_RESIZE_LAST_COLUMN, * AUTO_RESIZE_ALL_COLUMNS * * @see #getAutoResizeMode * @see #doLayout - * @beaninfo - * bound: true - * description: Whether the columns should adjust themselves automatically. - * enum: AUTO_RESIZE_OFF JTable.AUTO_RESIZE_OFF - * AUTO_RESIZE_NEXT_COLUMN JTable.AUTO_RESIZE_NEXT_COLUMN - * AUTO_RESIZE_SUBSEQUENT_COLUMNS JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS - * AUTO_RESIZE_LAST_COLUMN JTable.AUTO_RESIZE_LAST_COLUMN - * AUTO_RESIZE_ALL_COLUMNS JTable.AUTO_RESIZE_ALL_COLUMNS */ public void setAutoResizeMode(int mode) { if (isValidAutoResizeMode(mode)) { int old = autoResizeMode; autoResizeMode = mode; resizeAndRepaint(); --- 1184,1201 ---- * AUTO_RESIZE_LAST_COLUMN, * AUTO_RESIZE_ALL_COLUMNS * * @see #getAutoResizeMode * @see #doLayout */ + @BeanProperty(enumerationValues = { + "JTable.AUTO_RESIZE_OFF", + "JTable.AUTO_RESIZE_NEXT_COLUMN", + "JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS", + "JTable.AUTO_RESIZE_LAST_COLUMN", + "JTable.AUTO_RESIZE_ALL_COLUMNS"}, description + = "Whether the columns should adjust themselves automatically.") public void setAutoResizeMode(int mode) { if (isValidAutoResizeMode(mode)) { int old = autoResizeMode; autoResizeMode = mode; resizeAndRepaint();
*** 1242,1255 **** * <code>autoCreateColumnsFromModel</code> changes from false to true. * * @param autoCreateColumnsFromModel true if <code>JTable</code> should automatically create columns * @see #getAutoCreateColumnsFromModel * @see #createDefaultColumnsFromModel - * @beaninfo - * bound: true - * description: Automatically populates the columnModel when a new TableModel is submitted. */ public void setAutoCreateColumnsFromModel(boolean autoCreateColumnsFromModel) { if (this.autoCreateColumnsFromModel != autoCreateColumnsFromModel) { boolean old = this.autoCreateColumnsFromModel; this.autoCreateColumnsFromModel = autoCreateColumnsFromModel; if (autoCreateColumnsFromModel) { --- 1233,1245 ---- * <code>autoCreateColumnsFromModel</code> changes from false to true. * * @param autoCreateColumnsFromModel true if <code>JTable</code> should automatically create columns * @see #getAutoCreateColumnsFromModel * @see #createDefaultColumnsFromModel */ + @BeanProperty(description + = "Automatically populates the columnModel when a new TableModel is submitted.") public void setAutoCreateColumnsFromModel(boolean autoCreateColumnsFromModel) { if (this.autoCreateColumnsFromModel != autoCreateColumnsFromModel) { boolean old = this.autoCreateColumnsFromModel; this.autoCreateColumnsFromModel = autoCreateColumnsFromModel; if (autoCreateColumnsFromModel) {
*** 1436,1450 **** * @see java.awt.GraphicsEnvironment#isHeadless * @see #getDragEnabled * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; } --- 1426,1438 ---- * @see java.awt.GraphicsEnvironment#isHeadless * @see #getDragEnabled * @see #setTransferHandler * @see TransferHandler * @since 1.4 */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; }
*** 1828,1837 **** --- 1816,1826 ---- * @return the drop location * @see #setDropMode * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } /**
*** 1847,1862 **** * property is {@code false}. * * @param autoCreateRowSorter whether or not a {@code RowSorter} * should be automatically created * @see javax.swing.table.TableRowSorter - * @beaninfo - * bound: true - * preferred: true - * description: Whether or not to turn on sorting by default. * @since 1.6 */ public void setAutoCreateRowSorter(boolean autoCreateRowSorter) { boolean oldValue = this.autoCreateRowSorter; this.autoCreateRowSorter = autoCreateRowSorter; if (autoCreateRowSorter) { setRowSorter(new TableRowSorter<TableModel>(getModel())); --- 1836,1849 ---- * property is {@code false}. * * @param autoCreateRowSorter whether or not a {@code RowSorter} * should be automatically created * @see javax.swing.table.TableRowSorter * @since 1.6 */ + @BeanProperty(preferred = true, description + = "Whether or not to turn on sorting by default.") public void setAutoCreateRowSorter(boolean autoCreateRowSorter) { boolean oldValue = this.autoCreateRowSorter; this.autoCreateRowSorter = autoCreateRowSorter; if (autoCreateRowSorter) { setRowSorter(new TableRowSorter<TableModel>(getModel()));
*** 1883,1898 **** * If true, on sorting the selection is reset such that * the same rows, in terms of the model, remain selected. The default * is true. * * @param update whether or not to update the selection on sorting - * @beaninfo - * bound: true - * expert: true - * description: Whether or not to update the selection on sorting * @since 1.6 */ public void setUpdateSelectionOnSort(boolean update) { if (updateSelectionOnSort != update) { updateSelectionOnSort = update; firePropertyChange("updateSelectionOnSort", !update, update); } --- 1870,1883 ---- * If true, on sorting the selection is reset such that * the same rows, in terms of the model, remain selected. The default * is true. * * @param update whether or not to update the selection on sorting * @since 1.6 */ + @BeanProperty(expert = true, description + = "Whether or not to update the selection on sorting") public void setUpdateSelectionOnSort(boolean update) { if (updateSelectionOnSort != update) { updateSelectionOnSort = update; firePropertyChange("updateSelectionOnSort", !update, update); }
*** 1923,1937 **** * that of this <code>JTable</code> undefined behavior will result. * * @param sorter the <code>RowSorter</code>; <code>null</code> turns * sorting off * @see javax.swing.table.TableRowSorter - * @beaninfo - * bound: true - * description: The table's RowSorter * @since 1.6 */ public void setRowSorter(RowSorter<? extends TableModel> sorter) { RowSorter<? extends TableModel> oldRowSorter = null; if (sortManager != null) { oldRowSorter = sortManager.sorter; sortManager.dispose(); --- 1908,1921 ---- * that of this <code>JTable</code> undefined behavior will result. * * @param sorter the <code>RowSorter</code>; <code>null</code> turns * sorting off * @see javax.swing.table.TableRowSorter * @since 1.6 */ + @BeanProperty(description + = "The table's RowSorter") public void setRowSorter(RowSorter<? extends TableModel> sorter) { RowSorter<? extends TableModel> oldRowSorter = null; if (sortManager != null) { oldRowSorter = sortManager.sorter; sortManager.dispose();
*** 1979,1994 **** * <code>JList</code>. See the <code>setSelectionMode</code> method * in <code>JList</code> for details about the modes. * * @param selectionMode the mode used by the row and column selection models * @see JList#setSelectionMode - * @beaninfo - * description: The selection mode used by the row and column selection models. - * enum: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION - * SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION - * MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION */ public void setSelectionMode(int selectionMode) { clearSelection(); getSelectionModel().setSelectionMode(selectionMode); getColumnModel().getSelectionModel().setSelectionMode(selectionMode); } --- 1963,1978 ---- * <code>JList</code>. See the <code>setSelectionMode</code> method * in <code>JList</code> for details about the modes. * * @param selectionMode the mode used by the row and column selection models * @see JList#setSelectionMode */ + @BeanProperty(enumerationValues = { + "ListSelectionModel.SINGLE_SELECTION", + "ListSelectionModel.SINGLE_INTERVAL_SELECTION", + "ListSelectionModel.MULTIPLE_INTERVAL_SELECTION"}, description + = "The selection mode used by the row and column selection models.") public void setSelectionMode(int selectionMode) { clearSelection(); getSelectionModel().setSelectionMode(selectionMode); getColumnModel().getSelectionModel().setSelectionMode(selectionMode); }
*** 1996,2010 **** /** * Sets whether the rows in this model can be selected. * * @param rowSelectionAllowed true if this model will allow row selection * @see #getRowSelectionAllowed - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, an entire row is selected for each selected cell. */ public void setRowSelectionAllowed(boolean rowSelectionAllowed) { boolean old = this.rowSelectionAllowed; this.rowSelectionAllowed = rowSelectionAllowed; if (old != rowSelectionAllowed) { repaint(); --- 1980,1992 ---- /** * Sets whether the rows in this model can be selected. * * @param rowSelectionAllowed true if this model will allow row selection * @see #getRowSelectionAllowed */ + @BeanProperty(visualUpdate = true, description + = "If true, an entire row is selected for each selected cell.") public void setRowSelectionAllowed(boolean rowSelectionAllowed) { boolean old = this.rowSelectionAllowed; this.rowSelectionAllowed = rowSelectionAllowed; if (old != rowSelectionAllowed) { repaint();
*** 2025,2039 **** /** * Sets whether the columns in this model can be selected. * * @param columnSelectionAllowed true if this model will allow column selection * @see #getColumnSelectionAllowed - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, an entire column is selected for each selected cell. */ public void setColumnSelectionAllowed(boolean columnSelectionAllowed) { boolean old = columnModel.getColumnSelectionAllowed(); columnModel.setColumnSelectionAllowed(columnSelectionAllowed); if (old != columnSelectionAllowed) { repaint(); --- 2007,2019 ---- /** * Sets whether the columns in this model can be selected. * * @param columnSelectionAllowed true if this model will allow column selection * @see #getColumnSelectionAllowed */ + @BeanProperty(visualUpdate = true, description + = "If true, an entire column is selected for each selected cell.") public void setColumnSelectionAllowed(boolean columnSelectionAllowed) { boolean old = columnModel.getColumnSelectionAllowed(); columnModel.setColumnSelectionAllowed(columnSelectionAllowed); if (old != columnSelectionAllowed) { repaint();
*** 2063,2078 **** * * @param cellSelectionEnabled true if simultaneous row and column * selection is allowed * @see #getCellSelectionEnabled * @see #isCellSelected - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Select a rectangular region of cells rather than - * rows or columns. */ public void setCellSelectionEnabled(boolean cellSelectionEnabled) { setRowSelectionAllowed(cellSelectionEnabled); setColumnSelectionAllowed(cellSelectionEnabled); boolean old = this.cellSelectionEnabled; this.cellSelectionEnabled = cellSelectionEnabled; --- 2043,2055 ---- * * @param cellSelectionEnabled true if simultaneous row and column * selection is allowed * @see #getCellSelectionEnabled * @see #isCellSelected */ + @BeanProperty(visualUpdate = true, description + = "Select a rectangular region of cells rather than rows or columns.") public void setCellSelectionEnabled(boolean cellSelectionEnabled) { setRowSelectionAllowed(cellSelectionEnabled); setColumnSelectionAllowed(cellSelectionEnabled); boolean old = this.cellSelectionEnabled; this.cellSelectionEnabled = cellSelectionEnabled;
*** 2256,2274 **** --- 2233,2253 ---- /** * Returns the index of the first selected row, -1 if no row is selected. * @return the index of the first selected row */ + @BeanProperty(bound = false) public int getSelectedRow() { return selectionModel.getMinSelectionIndex(); } /** * Returns the index of the first selected column, * -1 if no column is selected. * @return the index of the first selected column */ + @BeanProperty(bound = false) public int getSelectedColumn() { return columnModel.getSelectionModel().getMinSelectionIndex(); } /**
*** 2276,2285 **** --- 2255,2265 ---- * * @return an array of integers containing the indices of all selected rows, * or an empty array if no row is selected * @see #getSelectedRow */ + @BeanProperty(bound = false) public int[] getSelectedRows() { int iMin = selectionModel.getMinSelectionIndex(); int iMax = selectionModel.getMaxSelectionIndex(); if ((iMin == -1) || (iMax == -1)) {
*** 2303,2321 **** --- 2283,2303 ---- * * @return an array of integers containing the indices of all selected columns, * or an empty array if no column is selected * @see #getSelectedColumn */ + @BeanProperty(bound = false) public int[] getSelectedColumns() { return columnModel.getSelectedColumns(); } /** * Returns the number of selected rows. * * @return the number of selected rows, 0 if no rows are selected */ + @BeanProperty(bound = false) public int getSelectedRowCount() { int iMin = selectionModel.getMinSelectionIndex(); int iMax = selectionModel.getMaxSelectionIndex(); int count = 0;
*** 2330,2339 **** --- 2312,2322 ---- /** * Returns the number of selected columns. * * @return the number of selected columns, 0 if no columns are selected */ + @BeanProperty(bound = false) public int getSelectedColumnCount() { return columnModel.getSelectedColumnCount(); } /**
*** 2517,2530 **** * @see #getSelectionForeground * @see #setSelectionBackground * @see #setForeground * @see #setBackground * @see #setFont - * @beaninfo - * bound: true - * description: A default foreground color for selected cells. */ public void setSelectionForeground(Color selectionForeground) { Color old = this.selectionForeground; this.selectionForeground = selectionForeground; firePropertyChange("selectionForeground", old, selectionForeground); repaint(); --- 2500,2512 ---- * @see #getSelectionForeground * @see #setSelectionBackground * @see #setForeground * @see #setBackground * @see #setFont */ + @BeanProperty(description + = "A default foreground color for selected cells.") public void setSelectionForeground(Color selectionForeground) { Color old = this.selectionForeground; this.selectionForeground = selectionForeground; firePropertyChange("selectionForeground", old, selectionForeground); repaint();
*** 2555,2568 **** * @see #getSelectionBackground * @see #setSelectionForeground * @see #setForeground * @see #setBackground * @see #setFont - * @beaninfo - * bound: true - * description: A default background color for selected cells. */ public void setSelectionBackground(Color selectionBackground) { Color old = this.selectionBackground; this.selectionBackground = selectionBackground; firePropertyChange("selectionBackground", old, selectionBackground); repaint(); --- 2537,2549 ---- * @see #getSelectionBackground * @see #setSelectionForeground * @see #setForeground * @see #setBackground * @see #setFont */ + @BeanProperty(description + = "A default background color for selected cells.") public void setSelectionBackground(Color selectionBackground) { Color old = this.selectionBackground; this.selectionBackground = selectionBackground; firePropertyChange("selectionBackground", old, selectionBackground); repaint();
*** 2674,2683 **** --- 2655,2665 ---- * <code>TableModel</code>. * * @return the number of rows shown in the <code>JTable</code> * @see #getColumnCount */ + @BeanProperty(bound = false) public int getRowCount() { RowSorter<?> sorter = getRowSorter(); if (sorter != null) { return sorter.getViewRowCount(); }
*** 2690,2699 **** --- 2672,2682 ---- * * @return the number of columns in the table * @see #getRowCount * @see #removeColumn */ + @BeanProperty(bound = false) public int getColumnCount() { return getColumnModel().getColumnCount(); } /**
*** 3558,3577 **** --- 3541,3562 ---- * * @return true if the table is editing a cell * @see #editingColumn * @see #editingRow */ + @BeanProperty(bound = false) public boolean isEditing() { return cellEditor != null; } /** * Returns the component that is handling the editing session. * If nothing is being edited, returns null. * * @return Component handling editing session */ + @BeanProperty(bound = false) public Component getEditorComponent() { return editorComp; } /**
*** 3614,3629 **** /** * Sets the L&amp;F object that renders this component and repaints. * * @param ui the TableUI L&amp;F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ public void setUI(TableUI ui) { if (this.ui != ui) { super.setUI(ui); repaint(); } --- 3599,3611 ---- /** * Sets the L&amp;F object that renders this component and repaints. * * @param ui the TableUI L&amp;F object * @see UIDefaults#getUI */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(TableUI ui) { if (this.ui != ui) { super.setUI(ui); repaint(); }
*** 3675,3684 **** --- 3657,3667 ---- * * @return the string "TableUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; }
*** 3691,3704 **** * with it for listener notifications from the new data model. * * @param dataModel the new data source for this table * @exception IllegalArgumentException if <code>newModel</code> is <code>null</code> * @see #getModel - * @beaninfo - * bound: true - * description: The model that is the source of the data for this view. */ public void setModel(TableModel dataModel) { if (dataModel == null) { throw new IllegalArgumentException("Cannot set a null TableModel"); } if (this.dataModel != dataModel) { --- 3674,3686 ---- * with it for listener notifications from the new data model. * * @param dataModel the new data source for this table * @exception IllegalArgumentException if <code>newModel</code> is <code>null</code> * @see #getModel */ + @BeanProperty(description + = "The model that is the source of the data for this view.") public void setModel(TableModel dataModel) { if (dataModel == null) { throw new IllegalArgumentException("Cannot set a null TableModel"); } if (this.dataModel != dataModel) {
*** 3736,3749 **** * the column model of the <code>JTableHeader</code> to <code>columnModel</code>. * * @param columnModel the new data source for this table * @exception IllegalArgumentException if <code>columnModel</code> is <code>null</code> * @see #getColumnModel - * @beaninfo - * bound: true - * description: The object governing the way columns appear in the view. */ public void setColumnModel(TableColumnModel columnModel) { if (columnModel == null) { throw new IllegalArgumentException("Cannot set a null ColumnModel"); } TableColumnModel old = this.columnModel; --- 3718,3730 ---- * the column model of the <code>JTableHeader</code> to <code>columnModel</code>. * * @param columnModel the new data source for this table * @exception IllegalArgumentException if <code>columnModel</code> is <code>null</code> * @see #getColumnModel */ + @BeanProperty(description + = "The object governing the way columns appear in the view.") public void setColumnModel(TableColumnModel columnModel) { if (columnModel == null) { throw new IllegalArgumentException("Cannot set a null ColumnModel"); } TableColumnModel old = this.columnModel;
*** 3780,3793 **** * and registers for listener notifications from the new selection model. * * @param newModel the new selection model * @exception IllegalArgumentException if <code>newModel</code> is <code>null</code> * @see #getSelectionModel - * @beaninfo - * bound: true - * description: The selection model for rows. */ public void setSelectionModel(ListSelectionModel newModel) { if (newModel == null) { throw new IllegalArgumentException("Cannot set a null SelectionModel"); } --- 3761,3773 ---- * and registers for listener notifications from the new selection model. * * @param newModel the new selection model * @exception IllegalArgumentException if <code>newModel</code> is <code>null</code> * @see #getSelectionModel */ + @BeanProperty(description + = "The selection model for rows.") public void setSelectionModel(ListSelectionModel newModel) { if (newModel == null) { throw new IllegalArgumentException("Cannot set a null SelectionModel"); }
*** 4771,4783 **** * Sets the preferred size of the viewport for this table. * * @param size a <code>Dimension</code> object specifying the <code>preferredSize</code> of a * <code>JViewport</code> whose view is this table * @see Scrollable#getPreferredScrollableViewportSize - * @beaninfo - * description: The preferred size of the viewport. */ public void setPreferredScrollableViewportSize(Dimension size) { preferredViewportSize = size; } /** --- 4751,4763 ---- * Sets the preferred size of the viewport for this table. * * @param size a <code>Dimension</code> object specifying the <code>preferredSize</code> of a * <code>JViewport</code> whose view is this table * @see Scrollable#getPreferredScrollableViewportSize */ + @BeanProperty(bound = false, description + = "The preferred size of the viewport.") public void setPreferredScrollableViewportSize(Dimension size) { preferredViewportSize = size; } /**
*** 5209,5218 **** --- 5189,5199 ---- * * @return false if <code>autoResizeMode</code> is set * to <code>AUTO_RESIZE_OFF</code>, otherwise returns true * @see Scrollable#getScrollableTracksViewportWidth */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { return !(autoResizeMode == AUTO_RESIZE_OFF); } /**
*** 5226,5235 **** --- 5207,5217 ---- * the viewport * @see Scrollable#getScrollableTracksViewportHeight * @see #setFillsViewportHeight * @see #getFillsViewportHeight */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); return getFillsViewportHeight() && parent instanceof JViewport && parent.getHeight() > getPreferredSize().height;
*** 5247,5261 **** * made large enough to fill the height of an enclosing * viewport * @see #getFillsViewportHeight * @see #getScrollableTracksViewportHeight * @since 1.6 - * @beaninfo - * bound: true - * description: Whether or not this table is always made large enough - * to fill the height of an enclosing viewport */ public void setFillsViewportHeight(boolean fillsViewportHeight) { boolean old = this.fillsViewportHeight; this.fillsViewportHeight = fillsViewportHeight; resizeAndRepaint(); firePropertyChange("fillsViewportHeight", old, fillsViewportHeight); --- 5229,5241 ---- * made large enough to fill the height of an enclosing * viewport * @see #getFillsViewportHeight * @see #getScrollableTracksViewportHeight * @since 1.6 */ + @BeanProperty(description + = "Whether or not this table is always made large enough to fill the height of an enclosing viewport") public void setFillsViewportHeight(boolean fillsViewportHeight) { boolean old = this.fillsViewportHeight; this.fillsViewportHeight = fillsViewportHeight; resizeAndRepaint(); firePropertyChange("fillsViewportHeight", old, fillsViewportHeight);
*** 5648,5661 **** /** * Sets the active cell editor. * * @param anEditor the active cell editor * @see #cellEditor - * @beaninfo - * bound: true - * description: The table's active cell editor. */ public void setCellEditor(TableCellEditor anEditor) { TableCellEditor oldEditor = cellEditor; cellEditor = anEditor; firePropertyChange("tableCellEditor", oldEditor, anEditor); } --- 5628,5640 ---- /** * Sets the active cell editor. * * @param anEditor the active cell editor * @see #cellEditor */ + @BeanProperty(description + = "The table's active cell editor.") public void setCellEditor(TableCellEditor anEditor) { TableCellEditor oldEditor = cellEditor; cellEditor = anEditor; firePropertyChange("tableCellEditor", oldEditor, anEditor); }
*** 6644,6653 **** --- 6623,6633 ---- * A new AccessibleJTable instance is created if necessary. * * @return an AccessibleJTable that serves as the * AccessibleContext of this JTable */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTable(); } return accessibleContext;