< prev index next >

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

Print this page

        

*** 61,78 **** import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; import sun.swing.PrintingStatus; /** ! * The <code>JTable</code> is used to display and edit regular two-dimensional tables * of cells. * See <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html">How to Use Tables</a> * in <em>The Java Tutorial</em> ! * for task-oriented documentation and examples of using <code>JTable</code>. * * <p> ! * The <code>JTable</code> has many * facilities that make it possible to customize its rendering and editing * but provides defaults for these features so that simple tables can be * set up easily. For example, to set up a table with 10 rows and 10 * columns of numbers: * --- 61,78 ---- import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; import sun.swing.PrintingStatus; /** ! * The {@code JTable} is used to display and edit regular two-dimensional tables * of cells. * See <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html">How to Use Tables</a> * in <em>The Java Tutorial</em> ! * for task-oriented documentation and examples of using {@code JTable}. * * <p> ! * The {@code JTable} has many * facilities that make it possible to customize its rendering and editing * but provides defaults for these features so that simple tables can be * set up easily. For example, to set up a table with 10 rows and 10 * columns of numbers: *
*** 88,99 **** * <p> * {@code JTable}s are typically placed inside of a {@code JScrollPane}. By * default, a {@code JTable} will adjust its width such that * a horizontal scrollbar is unnecessary. To allow for a horizontal scrollbar, * invoke {@link #setAutoResizeMode} with {@code AUTO_RESIZE_OFF}. ! * Note that if you wish to use a <code>JTable</code> in a standalone ! * view (outside of a <code>JScrollPane</code>) and want the header * displayed, you can get it using {@link #getTableHeader} and * display it separately. * <p> * To enable sorting and filtering of rows, use a * {@code RowSorter}. --- 88,99 ---- * <p> * {@code JTable}s are typically placed inside of a {@code JScrollPane}. By * default, a {@code JTable} will adjust its width such that * a horizontal scrollbar is unnecessary. To allow for a horizontal scrollbar, * invoke {@link #setAutoResizeMode} with {@code AUTO_RESIZE_OFF}. ! * Note that if you wish to use a {@code JTable} in a standalone ! * view (outside of a {@code JScrollPane}) and want the header * displayed, you can get it using {@link #getTableHeader} and * display it separately. * <p> * To enable sorting and filtering of rows, use a * {@code RowSorter}.
*** 105,196 **** * property to {@code true}, so that the {@code JTable} * creates a {@code RowSorter} for * you. For example: {@code setAutoCreateRowSorter(true)}. * </ul> * <p> ! * When designing applications that use the <code>JTable</code> it is worth paying * close attention to the data structures that will represent the table's data. ! * The <code>DefaultTableModel</code> is a model implementation that ! * uses a <code>Vector</code> of <code>Vector</code>s of <code>Object</code>s to * store the cell values. As well as copying the data from an ! * application into the <code>DefaultTableModel</code>, * it is also possible to wrap the data in the methods of the ! * <code>TableModel</code> interface so that the data can be passed to the ! * <code>JTable</code> directly, as in the example above. This often results * in more efficient applications because the model is free to choose the * internal representation that best suits the data. ! * A good rule of thumb for deciding whether to use the <code>AbstractTableModel</code> ! * or the <code>DefaultTableModel</code> is to use the <code>AbstractTableModel</code> ! * as the base class for creating subclasses and the <code>DefaultTableModel</code> * when subclassing is not required. * <p> * The "TableExample" directory in the demo area of the source distribution ! * gives a number of complete examples of <code>JTable</code> usage, ! * covering how the <code>JTable</code> can be used to provide an * editable view of data taken from a database and how to modify * the columns in the display to use specialized renderers and editors. * <p> ! * The <code>JTable</code> uses integers exclusively to refer to both the rows and the columns ! * of the model that it displays. The <code>JTable</code> simply takes a tabular range of cells ! * and uses <code>getValueAt(int, int)</code> to retrieve the * values from the model during painting. It is important to remember that ! * the column and row indexes returned by various <code>JTable</code> methods ! * are in terms of the <code>JTable</code> (the view) and are not * necessarily the same indexes used by the model. * <p> ! * By default, columns may be rearranged in the <code>JTable</code> so that the * view's columns appear in a different order to the columns in the model. * This does not affect the implementation of the model at all: when the ! * columns are reordered, the <code>JTable</code> maintains the new order of the columns * internally and converts its column indices before querying the model. * <p> ! * So, when writing a <code>TableModel</code>, it is not necessary to listen for column * reordering events as the model will be queried in its own coordinate * system regardless of what is happening in the view. * In the examples area there is a demonstration of a sorting algorithm making * use of exactly this technique to interpose yet another coordinate system * where the order of the rows is changed, rather than the order of the columns. * <p> * Similarly when using the sorting and filtering functionality ! * provided by <code>RowSorter</code> the underlying ! * <code>TableModel</code> does not need to know how to do sorting, ! * rather <code>RowSorter</code> will handle it. Coordinate * conversions will be necessary when using the row based methods of ! * <code>JTable</code> with the underlying <code>TableModel</code>. ! * All of <code>JTable</code>s row based methods are in terms of the ! * <code>RowSorter</code>, which is not necessarily the same as that ! * of the underlying <code>TableModel</code>. For example, the ! * selection is always in terms of <code>JTable</code> so that when ! * using <code>RowSorter</code> you will need to convert using ! * <code>convertRowIndexToView</code> or ! * <code>convertRowIndexToModel</code>. The following shows how to ! * convert coordinates from <code>JTable</code> to that of the * underlying model: * <pre> * int[] selection = table.getSelectedRows(); * for (int i = 0; i &lt; selection.length; i++) { * selection[i] = table.convertRowIndexToModel(selection[i]); * } * // selection is now in terms of the underlying TableModel * </pre> * <p> ! * By default if sorting is enabled <code>JTable</code> will persist the * selection and variable row heights in terms of the model on * sorting. For example if row 0, in terms of the underlying model, * is currently selected, after the sort row 0, in terms of the * underlying model will be selected. Visually the selection may * change, but in terms of the underlying model it will remain the * same. The one exception to that is if the model index is no longer * visible or was removed. For example, if row 0 in terms of model * was filtered out the selection will be empty after the sort. * <p> ! * J2SE 5 adds methods to <code>JTable</code> to provide convenient access to some * common printing needs. Simple new {@link #print()} methods allow for quick * and easy addition of printing support to your application. In addition, a new * {@link #getPrintable} method is available for more advanced printing needs. * <p> ! * As for all <code>JComponent</code> classes, you can use * {@link InputMap} and {@link ActionMap} to associate an * {@link Action} object with a {@link KeyStroke} and execute the * action under specified conditions. * <p> * <strong>Warning:</strong> Swing is not thread safe. For more --- 105,196 ---- * property to {@code true}, so that the {@code JTable} * creates a {@code RowSorter} for * you. For example: {@code setAutoCreateRowSorter(true)}. * </ul> * <p> ! * When designing applications that use the {@code JTable} it is worth paying * close attention to the data structures that will represent the table's data. ! * The {@code DefaultTableModel} is a model implementation that ! * uses a {@code Vector} of {@code Vector}s of {@code Object}s to * store the cell values. As well as copying the data from an ! * application into the {@code DefaultTableModel}, * it is also possible to wrap the data in the methods of the ! * {@code TableModel} interface so that the data can be passed to the ! * {@code JTable} directly, as in the example above. This often results * in more efficient applications because the model is free to choose the * internal representation that best suits the data. ! * A good rule of thumb for deciding whether to use the {@code AbstractTableModel} ! * or the {@code DefaultTableModel} is to use the {@code AbstractTableModel} ! * as the base class for creating subclasses and the {@code DefaultTableModel} * when subclassing is not required. * <p> * The "TableExample" directory in the demo area of the source distribution ! * gives a number of complete examples of {@code JTable} usage, ! * covering how the {@code JTable} can be used to provide an * editable view of data taken from a database and how to modify * the columns in the display to use specialized renderers and editors. * <p> ! * The {@code JTable} uses integers exclusively to refer to both the rows and the columns ! * of the model that it displays. The {@code JTable} simply takes a tabular range of cells ! * and uses {@code getValueAt(int, int)} to retrieve the * values from the model during painting. It is important to remember that ! * the column and row indexes returned by various {@code JTable} methods ! * are in terms of the {@code JTable} (the view) and are not * necessarily the same indexes used by the model. * <p> ! * By default, columns may be rearranged in the {@code JTable} so that the * view's columns appear in a different order to the columns in the model. * This does not affect the implementation of the model at all: when the ! * columns are reordered, the {@code JTable} maintains the new order of the columns * internally and converts its column indices before querying the model. * <p> ! * So, when writing a {@code TableModel}, it is not necessary to listen for column * reordering events as the model will be queried in its own coordinate * system regardless of what is happening in the view. * In the examples area there is a demonstration of a sorting algorithm making * use of exactly this technique to interpose yet another coordinate system * where the order of the rows is changed, rather than the order of the columns. * <p> * Similarly when using the sorting and filtering functionality ! * provided by {@code RowSorter} the underlying ! * {@code TableModel} does not need to know how to do sorting, ! * rather {@code RowSorter} will handle it. Coordinate * conversions will be necessary when using the row based methods of ! * {@code JTable} with the underlying {@code TableModel}. ! * All of {@code JTable}s row based methods are in terms of the ! * {@code RowSorter}, which is not necessarily the same as that ! * of the underlying {@code TableModel}. For example, the ! * selection is always in terms of {@code JTable} so that when ! * using {@code RowSorter} you will need to convert using ! * {@code convertRowIndexToView} or ! * {@code convertRowIndexToModel}. The following shows how to ! * convert coordinates from {@code JTable} to that of the * underlying model: * <pre> * int[] selection = table.getSelectedRows(); * for (int i = 0; i &lt; selection.length; i++) { * selection[i] = table.convertRowIndexToModel(selection[i]); * } * // selection is now in terms of the underlying TableModel * </pre> * <p> ! * By default if sorting is enabled {@code JTable} will persist the * selection and variable row heights in terms of the model on * sorting. For example if row 0, in terms of the underlying model, * is currently selected, after the sort row 0, in terms of the * underlying model will be selected. Visually the selection may * change, but in terms of the underlying model it will remain the * same. The one exception to that is if the model index is no longer * visible or was removed. For example, if row 0 in terms of model * was filtered out the selection will be empty after the sort. * <p> ! * J2SE 5 adds methods to {@code JTable} to provide convenient access to some * common printing needs. Simple new {@link #print()} methods allow for quick * and easy addition of printing support to your application. In addition, a new * {@link #getPrintable} method is available for more advanced printing needs. * <p> ! * As for all {@code JComponent} classes, you can use * {@link InputMap} and {@link ActionMap} to associate an * {@link Action} object with a {@link KeyStroke} and execute the * action under specified conditions. * <p> * <strong>Warning:</strong> Swing is not thread safe. For more
*** 202,212 **** * 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. 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 --- 202,212 ---- * 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. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * * @beaninfo * attribute: isContainer false
*** 252,262 **** /** During all resize operations, proportionately resize all columns. */ public static final int AUTO_RESIZE_ALL_COLUMNS = 4; /** ! * Printing modes, used in printing <code>JTable</code>s. * * @see #print(JTable.PrintMode, MessageFormat, MessageFormat, * boolean, PrintRequestAttributeSet, boolean) * @see #getPrintable * @since 1.5 --- 252,262 ---- /** During all resize operations, proportionately resize all columns. */ public static final int AUTO_RESIZE_ALL_COLUMNS = 4; /** ! * Printing modes, used in printing {@code JTable}s. * * @see #print(JTable.PrintMode, MessageFormat, MessageFormat, * boolean, PrintRequestAttributeSet, boolean) * @see #getPrintable * @since 1.5
*** 280,299 **** // // Instance Variables // ! /** The <code>TableModel</code> of the table. */ protected TableModel dataModel; ! /** The <code>TableColumnModel</code> of the table. */ protected TableColumnModel columnModel; ! /** The <code>ListSelectionModel</code> of the table, used to keep track of row selections. */ protected ListSelectionModel selectionModel; ! /** The <code>TableHeader</code> working with the table. */ protected JTableHeader tableHeader; /** The height in pixels of each row in the table. */ protected int rowHeight; --- 280,299 ---- // // Instance Variables // ! /** The {@code TableModel} of the table. */ protected TableModel dataModel; ! /** The {@code TableColumnModel} of the table. */ protected TableColumnModel columnModel; ! /** The {@code ListSelectionModel} of the table, used to keep track of row selections. */ protected ListSelectionModel selectionModel; ! /** The {@code TableHeader} working with the table. */ protected JTableHeader tableHeader; /** The height in pixels of each row in the table. */ protected int rowHeight;
*** 301,350 **** protected int rowMargin; /** The color of the grid. */ protected Color gridColor; ! /** The table draws horizontal lines between cells if <code>showHorizontalLines</code> is true. */ protected boolean showHorizontalLines; ! /** The table draws vertical lines between cells if <code>showVerticalLines</code> is true. */ protected boolean showVerticalLines; /** * Determines if the table automatically resizes the * width of the table's columns to take up the entire width of the * table, and how it does the resizing. */ protected int autoResizeMode; /** ! * The table will query the <code>TableModel</code> to build the default * set of columns if this is true. */ protected boolean autoCreateColumnsFromModel; ! /** Used by the <code>Scrollable</code> interface to determine the initial visible area. */ protected Dimension preferredViewportSize; /** True if row selection is allowed in this table. */ protected boolean rowSelectionAllowed; /** * Obsolete as of Java 2 platform v1.3. Please use the ! * <code>rowSelectionAllowed</code> property and the ! * <code>columnSelectionAllowed</code> property of the ! * <code>columnModel</code> instead. Or use the ! * method <code>getCellSelectionEnabled</code>. */ /* * If true, both a row selection and a column selection * can be non-empty at the same time, the selected cells are the * the cells whose row and column are both selected. */ protected boolean cellSelectionEnabled; ! /** If editing, the <code>Component</code> that is handling the editing. */ protected transient Component editorComp; /** * The active cell editor object, that overwrites the screen real estate * occupied by the current cell and allows the user to change its contents. --- 301,350 ---- protected int rowMargin; /** The color of the grid. */ protected Color gridColor; ! /** The table draws horizontal lines between cells if {@code showHorizontalLines} is true. */ protected boolean showHorizontalLines; ! /** The table draws vertical lines between cells if {@code showVerticalLines} is true. */ protected boolean showVerticalLines; /** * Determines if the table automatically resizes the * width of the table's columns to take up the entire width of the * table, and how it does the resizing. */ protected int autoResizeMode; /** ! * The table will query the {@code TableModel} to build the default * set of columns if this is true. */ protected boolean autoCreateColumnsFromModel; ! /** Used by the {@code Scrollable} interface to determine the initial visible area. */ protected Dimension preferredViewportSize; /** True if row selection is allowed in this table. */ protected boolean rowSelectionAllowed; /** * Obsolete as of Java 2 platform v1.3. Please use the ! * {@code rowSelectionAllowed} property and the ! * {@code columnSelectionAllowed} property of the ! * {@code columnModel} instead. Or use the ! * method {@code getCellSelectionEnabled}. */ /* * If true, both a row selection and a column selection * can be non-empty at the same time, the selected cells are the * the cells whose row and column are both selected. */ protected boolean cellSelectionEnabled; ! /** If editing, the {@code Component} that is handling the editing. */ protected transient Component editorComp; /** * The active cell editor object, that overwrites the screen real estate * occupied by the current cell and allows the user to change its contents.
*** 358,378 **** /** Identifies the row of the cell being edited. */ protected transient int editingRow; /** * A table of objects that display the contents of a cell, ! * indexed by class as declared in <code>getColumnClass</code> ! * in the <code>TableModel</code> interface. */ protected transient Hashtable<Object, Object> defaultRenderersByColumnClass; // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>. // It is declared otherwise to accomodate using UIDefaults. /** * A table of objects that display and edit the contents of a cell, ! * indexed by class as declared in <code>getColumnClass</code> ! * in the <code>TableModel</code> interface. */ protected transient Hashtable<Object, Object> defaultEditorsByColumnClass; // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>. // It is declared otherwise to accomodate using UIDefaults. --- 358,378 ---- /** Identifies the row of the cell being edited. */ protected transient int editingRow; /** * A table of objects that display the contents of a cell, ! * indexed by class as declared in {@code getColumnClass} ! * in the {@code TableModel} interface. */ protected transient Hashtable<Object, Object> defaultRenderersByColumnClass; // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>. // It is declared otherwise to accomodate using UIDefaults. /** * A table of objects that display and edit the contents of a cell, ! * indexed by class as declared in {@code getColumnClass} ! * in the {@code TableModel} interface. */ protected transient Hashtable<Object, Object> defaultEditorsByColumnClass; // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>. // It is declared otherwise to accomodate using UIDefaults.
*** 455,466 **** * The drop location. */ private transient DropLocation dropLocation; /** ! * A subclass of <code>TransferHandler.DropLocation</code> representing ! * a drop location for a <code>JTable</code>. * * @see #getDropLocation * @since 1.6 */ public static final class DropLocation extends TransferHandler.DropLocation { --- 455,466 ---- * The drop location. */ private transient DropLocation dropLocation; /** ! * A subclass of {@code TransferHandler.DropLocation} representing ! * a drop location for a {@code JTable}. * * @see #getDropLocation * @since 1.6 */ public static final class DropLocation extends TransferHandler.DropLocation {
*** 480,496 **** } /** * Returns the row index where a dropped item should be placed in the * table. Interpretation of the value depends on the return of ! * <code>isInsertRow()</code>. If that method returns ! * <code>true</code> this value indicates the index where a new * row should be inserted. Otherwise, it represents the value * of an existing row on which the data was dropped. This index is * in terms of the view. * <p> ! * <code>-1</code> indicates that the drop occurred over empty space, * and no row could be calculated. * * @return the drop row */ public int getRow() { --- 480,496 ---- } /** * Returns the row index where a dropped item should be placed in the * table. Interpretation of the value depends on the return of ! * {@code isInsertRow()}. If that method returns ! * {@code true} this value indicates the index where a new * row should be inserted. Otherwise, it represents the value * of an existing row on which the data was dropped. This index is * in terms of the view. * <p> ! * {@code -1} indicates that the drop occurred over empty space, * and no row could be calculated. * * @return the drop row */ public int getRow() {
*** 498,514 **** } /** * Returns the column index where a dropped item should be placed in the * table. Interpretation of the value depends on the return of ! * <code>isInsertColumn()</code>. If that method returns ! * <code>true</code> this value indicates the index where a new * column should be inserted. Otherwise, it represents the value * of an existing column on which the data was dropped. This index is * in terms of the view. * <p> ! * <code>-1</code> indicates that the drop occurred over empty space, * and no column could be calculated. * * @return the drop row */ public int getColumn() { --- 498,514 ---- } /** * Returns the column index where a dropped item should be placed in the * table. Interpretation of the value depends on the return of ! * {@code isInsertColumn()}. If that method returns ! * {@code true} this value indicates the index where a new * column should be inserted. Otherwise, it represents the value * of an existing column on which the data was dropped. This index is * in terms of the view. * <p> ! * {@code -1} indicates that the drop occurred over empty space, * and no column could be calculated. * * @return the drop row */ public int getColumn() {
*** 556,566 **** // // Constructors // /** ! * Constructs a default <code>JTable</code> that is initialized with a default * data model, a default column model, and a default selection * model. * * @see #createDefaultDataModel * @see #createDefaultColumnModel --- 556,566 ---- // // Constructors // /** ! * Constructs a default {@code JTable} that is initialized with a default * data model, a default column model, and a default selection * model. * * @see #createDefaultDataModel * @see #createDefaultColumnModel
*** 569,580 **** public JTable() { this(null, null, null); } /** ! * Constructs a <code>JTable</code> that is initialized with ! * <code>dm</code> as the data model, a default column model, * and a default selection model. * * @param dm the data model for the table * @see #createDefaultColumnModel * @see #createDefaultSelectionModel --- 569,580 ---- public JTable() { this(null, null, null); } /** ! * Constructs a {@code JTable} that is initialized with ! * {@code dm} as the data model, a default column model, * and a default selection model. * * @param dm the data model for the table * @see #createDefaultColumnModel * @see #createDefaultSelectionModel
*** 582,593 **** public JTable(TableModel dm) { this(dm, null, null); } /** ! * Constructs a <code>JTable</code> that is initialized with ! * <code>dm</code> as the data model, <code>cm</code> * as the column model, and a default selection model. * * @param dm the data model for the table * @param cm the column model for the table * @see #createDefaultSelectionModel --- 582,593 ---- public JTable(TableModel dm) { this(dm, null, null); } /** ! * Constructs a {@code JTable} that is initialized with ! * {@code dm} as the data model, {@code cm} * as the column model, and a default selection model. * * @param dm the data model for the table * @param cm the column model for the table * @see #createDefaultSelectionModel
*** 595,613 **** public JTable(TableModel dm, TableColumnModel cm) { this(dm, cm, null); } /** ! * Constructs a <code>JTable</code> that is initialized with ! * <code>dm</code> as the data model, <code>cm</code> as the ! * column model, and <code>sm</code> as the selection model. ! * If any of the parameters are <code>null</code> this method * will initialize the table with the corresponding default model. ! * The <code>autoCreateColumnsFromModel</code> flag is set to false ! * if <code>cm</code> is non-null, otherwise it is set to true * and the column model is populated with suitable ! * <code>TableColumns</code> for the columns in <code>dm</code>. * * @param dm the data model for the table * @param cm the column model for the table * @param sm the row selection model for the table * @see #createDefaultDataModel --- 595,613 ---- public JTable(TableModel dm, TableColumnModel cm) { this(dm, cm, null); } /** ! * Constructs a {@code JTable} that is initialized with ! * {@code dm} as the data model, {@code cm} as the ! * column model, and {@code sm} as the selection model. ! * If any of the parameters are {@code null} this method * will initialize the table with the corresponding default model. ! * The {@code autoCreateColumnsFromModel} flag is set to false ! * if {@code cm} is non-null, otherwise it is set to true * and the column model is populated with suitable ! * {@code TableColumns} for the columns in {@code dm}. * * @param dm the data model for the table * @param cm the column model for the table * @param sm the row selection model for the table * @see #createDefaultDataModel
*** 644,656 **** initializeLocalVars(); updateUI(); } /** ! * Constructs a <code>JTable</code> with <code>numRows</code> ! * and <code>numColumns</code> of empty cells using ! * <code>DefaultTableModel</code>. The columns will have * names of the form "A", "B", "C", etc. * * @param numRows the number of rows the table holds * @param numColumns the number of columns the table holds * @see javax.swing.table.DefaultTableModel --- 644,656 ---- initializeLocalVars(); updateUI(); } /** ! * Constructs a {@code JTable} with {@code numRows} ! * and {@code numColumns} of empty cells using ! * {@code DefaultTableModel}. The columns will have * names of the form "A", "B", "C", etc. * * @param numRows the number of rows the table holds * @param numColumns the number of columns the table holds * @see javax.swing.table.DefaultTableModel
*** 658,671 **** public JTable(int numRows, int numColumns) { this(new DefaultTableModel(numRows, numColumns)); } /** ! * Constructs a <code>JTable</code> to display the values in the ! * <code>Vector</code> of <code>Vectors</code>, <code>rowData</code>, ! * with column names, <code>columnNames</code>. The ! * <code>Vectors</code> contained in <code>rowData</code> * should contain the values for that row. In other words, * the value of the cell at row 1, column 5 can be obtained * with the following code: * * <pre>((Vector)rowData.elementAt(1)).elementAt(5);</pre> --- 658,671 ---- public JTable(int numRows, int numColumns) { this(new DefaultTableModel(numRows, numColumns)); } /** ! * Constructs a {@code JTable} to display the values in the ! * {@code Vector} of {@code Vectors}, {@code rowData}, ! * with column names, {@code columnNames}. The ! * {@code Vectors} contained in {@code rowData} * should contain the values for that row. In other words, * the value of the cell at row 1, column 5 can be obtained * with the following code: * * <pre>((Vector)rowData.elementAt(1)).elementAt(5);</pre>
*** 677,694 **** public JTable(Vector<? extends Vector> rowData, Vector<?> columnNames) { this(new DefaultTableModel(rowData, columnNames)); } /** ! * Constructs a <code>JTable</code> to display the values in the two dimensional array, ! * <code>rowData</code>, with column names, <code>columnNames</code>. ! * <code>rowData</code> is an array of rows, so the value of the cell at row 1, * column 5 can be obtained with the following code: * * <pre> rowData[1][5]; </pre> * <p> ! * All rows must be of the same length as <code>columnNames</code>. * * @param rowData the data for the new table * @param columnNames names of each column */ public JTable(final Object[][] rowData, final Object[] columnNames) { --- 677,694 ---- public JTable(Vector<? extends Vector> rowData, Vector<?> columnNames) { this(new DefaultTableModel(rowData, columnNames)); } /** ! * Constructs a {@code JTable} to display the values in the two dimensional array, ! * {@code rowData}, with column names, {@code columnNames}. ! * {@code rowData} is an array of rows, so the value of the cell at row 1, * column 5 can be obtained with the following code: * * <pre> rowData[1][5]; </pre> * <p> ! * All rows must be of the same length as {@code columnNames}. * * @param rowData the data for the new table * @param columnNames names of each column */ public JTable(final Object[][] rowData, final Object[] columnNames) {
*** 704,730 **** } }); } /** ! * Calls the <code>configureEnclosingScrollPane</code> method. * * @see #configureEnclosingScrollPane */ public void addNotify() { super.addNotify(); configureEnclosingScrollPane(); } /** ! * If this <code>JTable</code> is the <code>viewportView</code> of an enclosing <code>JScrollPane</code> ! * (the usual situation), configure this <code>ScrollPane</code> by, amongst other things, ! * installing the table's <code>tableHeader</code> as the <code>columnHeaderView</code> of the scroll pane. ! * When a <code>JTable</code> is added to a <code>JScrollPane</code> in the usual way, ! * using <code>new JScrollPane(myTable)</code>, <code>addNotify</code> is ! * called in the <code>JTable</code> (when the table is added to the viewport). ! * <code>JTable</code>'s <code>addNotify</code> method in turn calls this method, * which is protected so that this default installation procedure can * be overridden by a subclass. * * @see #addNotify */ --- 704,730 ---- } }); } /** ! * Calls the {@code configureEnclosingScrollPane} method. * * @see #configureEnclosingScrollPane */ public void addNotify() { super.addNotify(); configureEnclosingScrollPane(); } /** ! * If this {@code JTable} is the {@code viewportView} of an enclosing {@code JScrollPane} ! * (the usual situation), configure this {@code ScrollPane} by, amongst other things, ! * installing the table's {@code tableHeader} as the {@code columnHeaderView} of the scroll pane. ! * When a {@code JTable} is added to a {@code JScrollPane} in the usual way, ! * using {@code new JScrollPane(myTable)}, {@code addNotify} is ! * called in the {@code JTable} (when the table is added to the viewport). ! * {@code JTable}'s {@code addNotify} method in turn calls this method, * which is protected so that this default installation procedure can * be overridden by a subclass. * * @see #addNotify */
*** 803,813 **** } } } /** ! * Calls the <code>unconfigureEnclosingScrollPane</code> method. * * @see #unconfigureEnclosingScrollPane */ public void removeNotify() { KeyboardFocusManager.getCurrentKeyboardFocusManager(). --- 803,813 ---- } } } /** ! * Calls the {@code unconfigureEnclosingScrollPane} method. * * @see #unconfigureEnclosingScrollPane */ public void removeNotify() { KeyboardFocusManager.getCurrentKeyboardFocusManager().
*** 816,829 **** unconfigureEnclosingScrollPane(); super.removeNotify(); } /** ! * Reverses the effect of <code>configureEnclosingScrollPane</code> ! * by replacing the <code>columnHeaderView</code> of the enclosing ! * scroll pane with <code>null</code>. <code>JTable</code>'s ! * <code>removeNotify</code> method calls * this method, which is protected so that this default uninstallation * procedure can be overridden by a subclass. * * @see #removeNotify * @see #configureEnclosingScrollPane --- 816,829 ---- unconfigureEnclosingScrollPane(); super.removeNotify(); } /** ! * Reverses the effect of {@code configureEnclosingScrollPane} ! * by replacing the {@code columnHeaderView} of the enclosing ! * scroll pane with {@code null}. {@code JTable}'s ! * {@code removeNotify} method calls * this method, which is protected so that this default uninstallation * procedure can be overridden by a subclass. * * @see #removeNotify * @see #configureEnclosingScrollPane
*** 870,885 **** // // Static Methods // /** ! * Equivalent to <code>new JScrollPane(aTable)</code>. * * @param aTable a {@code JTable} to be used for the scroll pane * @return a {@code JScrollPane} created using {@code aTable} * @deprecated As of Swing version 1.0.2, ! * replaced by <code>new JScrollPane(aTable)</code>. */ @Deprecated public static JScrollPane createScrollPaneForTable(JTable aTable) { return new JScrollPane(aTable); } --- 870,885 ---- // // Static Methods // /** ! * Equivalent to {@code new JScrollPane(aTable)}. * * @param aTable a {@code JTable} to be used for the scroll pane * @return a {@code JScrollPane} created using {@code aTable} * @deprecated As of Swing version 1.0.2, ! * replaced by {@code new JScrollPane(aTable)}. */ @Deprecated public static JScrollPane createScrollPaneForTable(JTable aTable) { return new JScrollPane(aTable); }
*** 887,898 **** // // Table Attributes // /** ! * 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 --- 887,898 ---- // // Table Attributes // /** ! * Sets the {@code tableHeader} working with this {@code JTable} to {@code newHeader}. ! * It is legal to have a {@code null tableHeader}. * * @param tableHeader new tableHeader * @see #getTableHeader * @beaninfo * bound: true
*** 912,938 **** firePropertyChange("tableHeader", old, tableHeader); } } /** ! * Returns the <code>tableHeader</code> used by this <code>JTable</code>. * ! * @return the <code>tableHeader</code> used by this table * @see #setTableHeader */ public JTableHeader getTableHeader() { return tableHeader; } /** ! * Sets the height, in pixels, of all cells to <code>rowHeight</code>, * revalidates, and repaints. * The height of the cells will be equal to the row height minus * the row margin. * * @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. --- 912,938 ---- firePropertyChange("tableHeader", old, tableHeader); } } /** ! * Returns the {@code tableHeader} used by this {@code JTable}. * ! * @return the {@code tableHeader} used by this table * @see #setTableHeader */ public JTableHeader getTableHeader() { return tableHeader; } /** ! * Sets the height, in pixels, of all cells to {@code rowHeight}, * revalidates, and repaints. * The height of the cells will be equal to the row height minus * the row margin. * * @param rowHeight new row height ! * @exception IllegalArgumentException if {@code rowHeight} is * less than 1 * @see #getRowHeight * @beaninfo * bound: true * description: The height of the specified row.
*** 968,989 **** } return rowModel; } /** ! * Sets the height for <code>row</code> to <code>rowHeight</code>, * revalidates, and repaints. The height of the cells in this row * will be equal to the row height minus the row margin. * * @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"); --- 968,989 ---- } return rowModel; } /** ! * Sets the height for {@code row} to {@code rowHeight}, * revalidates, and repaints. The height of the cells in this row * will be equal to the row height minus the row margin. * * @param row the row whose height is being changed * @param rowHeight new row height, in pixels ! * @exception IllegalArgumentException if {@code rowHeight} is * less than 1 * @beaninfo * bound: true ! * description: The height in pixels of the cells in {@code row} * @since 1.3 */ public void setRowHeight(int row, int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1");
*** 994,1004 **** } resizeAndRepaint(); } /** ! * Returns the height, in pixels, of the cells in <code>row</code>. * @param row the row whose height is to be returned * @return the height, in pixels, of the cells in the row * @since 1.3 */ public int getRowHeight(int row) { --- 994,1004 ---- } resizeAndRepaint(); } /** ! * Returns the height, in pixels, of the cells in {@code row}. * @param row the row whose height is to be returned * @return the height, in pixels, of the cells in the row * @since 1.3 */ public int getRowHeight(int row) {
*** 1021,1045 **** firePropertyChange("rowMargin", old, rowMargin); } /** * Gets the amount of empty space, in pixels, between cells. Equivalent to: ! * <code>getIntercellSpacing().height</code>. * @return the number of pixels between cells in a row * * @see #setRowMargin */ public int getRowMargin() { return rowMargin; } /** ! * Sets the <code>rowMargin</code> and the <code>columnMargin</code> -- * the height and width of the space between cells -- to ! * <code>intercellSpacing</code>. * ! * @param intercellSpacing a <code>Dimension</code> * specifying the new width * and height between cells * @see #getIntercellSpacing * @beaninfo * description: The spacing between the cells, --- 1021,1045 ---- firePropertyChange("rowMargin", old, rowMargin); } /** * Gets the amount of empty space, in pixels, between cells. Equivalent to: ! * {@code getIntercellSpacing().height}. * @return the number of pixels between cells in a row * * @see #setRowMargin */ public int getRowMargin() { return rowMargin; } /** ! * Sets the {@code rowMargin} and the {@code columnMargin} -- * the height and width of the space between cells -- to ! * {@code intercellSpacing}. * ! * @param intercellSpacing a {@code Dimension} * specifying the new width * and height between cells * @see #getIntercellSpacing * @beaninfo * description: The spacing between the cells,
*** 1063,1077 **** public Dimension getIntercellSpacing() { return new Dimension(getColumnModel().getColumnMargin(), rowMargin); } /** ! * Sets the color used to draw grid lines to <code>gridColor</code> and redisplays. * 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. */ --- 1063,1077 ---- public Dimension getIntercellSpacing() { return new Dimension(getColumnModel().getColumnMargin(), rowMargin); } /** ! * Sets the color used to draw grid lines to {@code gridColor} and redisplays. * The default color is look and feel dependent. * * @param gridColor the new color of the grid lines ! * @exception IllegalArgumentException if {@code gridColor} is {@code null} * @see #getGridColor * @beaninfo * bound: true * description: The grid color. */
*** 1097,1109 **** return gridColor; } /** * Sets whether the table draws grid lines around cells. ! * If <code>showGrid</code> is true it does; if it is false it doesn't. ! * There is no <code>getShowGrid</code> method as this state is held ! * in two variables -- <code>showHorizontalLines</code> and <code>showVerticalLines</code> -- * each of which can be queried independently. * * @param showGrid true if table view should draw grid lines * * @see #setShowVerticalLines --- 1097,1109 ---- return gridColor; } /** * Sets whether the table draws grid lines around cells. ! * If {@code showGrid} is true it does; if it is false it doesn't. ! * There is no {@code getShowGrid} method as this state is held ! * in two variables -- {@code showHorizontalLines} and {@code showVerticalLines} -- * each of which can be queried independently. * * @param showGrid true if table view should draw grid lines * * @see #setShowVerticalLines
*** 1119,1129 **** repaint(); } /** * Sets whether the table draws horizontal lines between cells. ! * If <code>showHorizontalLines</code> is true it does; if it is false it doesn't. * * @param showHorizontalLines true if table view should draw horizontal lines * @see #getShowHorizontalLines * @see #setShowGrid * @see #setShowVerticalLines --- 1119,1129 ---- repaint(); } /** * Sets whether the table draws horizontal lines between cells. ! * If {@code showHorizontalLines} is true it does; if it is false it doesn't. * * @param showHorizontalLines true if table view should draw horizontal lines * @see #getShowHorizontalLines * @see #setShowGrid * @see #setShowVerticalLines
*** 1140,1150 **** repaint(); } /** * Sets whether the table draws vertical lines between cells. ! * If <code>showVerticalLines</code> is true it does; if it is false it doesn't. * * @param showVerticalLines true if table view should draw vertical lines * @see #getShowVerticalLines * @see #setShowGrid * @see #setShowHorizontalLines --- 1140,1150 ---- repaint(); } /** * Sets whether the table draws vertical lines between cells. ! * If {@code showVerticalLines} is true it does; if it is false it doesn't. * * @param showVerticalLines true if table view should draw vertical lines * @see #getShowVerticalLines * @see #setShowGrid * @see #setShowHorizontalLines
*** 1239,1253 **** public int getAutoResizeMode() { return autoResizeMode; } /** ! * Sets this table's <code>autoCreateColumnsFromModel</code> flag. ! * This method calls <code>createDefaultColumnsFromModel</code> if ! * <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. --- 1239,1253 ---- public int getAutoResizeMode() { return autoResizeMode; } /** ! * Sets this table's {@code autoCreateColumnsFromModel} flag. ! * This method calls {@code createDefaultColumnsFromModel} if ! * {@code autoCreateColumnsFromModel} changes from false to true. * ! * @param autoCreateColumnsFromModel true if {@code JTable} should automatically create columns * @see #getAutoCreateColumnsFromModel * @see #createDefaultColumnsFromModel * @beaninfo * bound: true * description: Automatically populates the columnModel when a new TableModel is submitted.
*** 1263,1275 **** } } /** * Determines whether the table will create default columns from the model. ! * If true, <code>setModel</code> will clear any existing columns and * create new columns from the new model. Also, if the event in ! * the <code>tableChanged</code> notification specifies that the * entire table changed, then the columns will be rebuilt. * The default is true. * * @return the autoCreateColumnsFromModel of the table * @see #setAutoCreateColumnsFromModel --- 1263,1275 ---- } } /** * Determines whether the table will create default columns from the model. ! * If true, {@code setModel} will clear any existing columns and * create new columns from the new model. Also, if the event in ! * the {@code tableChanged} notification specifies that the * entire table changed, then the columns will be rebuilt. * The default is true. * * @return the autoCreateColumnsFromModel of the table * @see #setAutoCreateColumnsFromModel
*** 1279,1290 **** return autoCreateColumnsFromModel; } /** * Creates default columns for the table from ! * the data model using the <code>getColumnCount</code> method ! * defined in the <code>TableModel</code> interface. * <p> * Clears any existing columns before creating the * new columns based on information from the model. * * @see #getAutoCreateColumnsFromModel --- 1279,1290 ---- return autoCreateColumnsFromModel; } /** * Creates default columns for the table from ! * the data model using the {@code getColumnCount} method ! * defined in the {@code TableModel} interface. * <p> * Clears any existing columns before creating the * new columns based on information from the model. * * @see #getAutoCreateColumnsFromModel
*** 1306,1316 **** } } /** * Sets a default cell renderer to be used if no renderer has been set in ! * a <code>TableColumn</code>. If renderer is <code>null</code>, * removes the default renderer for this column class. * * @param columnClass set the default cell renderer for this columnClass * @param renderer default cell renderer to be used for this * columnClass --- 1306,1316 ---- } } /** * Sets a default cell renderer to be used if no renderer has been set in ! * a {@code TableColumn}. If renderer is {@code null}, * removes the default renderer for this column class. * * @param columnClass set the default cell renderer for this columnClass * @param renderer default cell renderer to be used for this * columnClass
*** 1326,1340 **** } } /** * Returns the cell renderer to be used when no renderer has been set in ! * a <code>TableColumn</code>. During the rendering of cells the renderer is fetched from ! * a <code>Hashtable</code> of entries according to the class of the cells in the column. If ! * there is no entry for this <code>columnClass</code> the method returns ! * the entry for the most specific superclass. The <code>JTable</code> installs entries ! * for <code>Object</code>, <code>Number</code>, and <code>Boolean</code>, all of which can be modified * or replaced. * * @param columnClass return the default cell renderer * for this columnClass * @return the renderer for this columnClass --- 1326,1340 ---- } } /** * Returns the cell renderer to be used when no renderer has been set in ! * a {@code TableColumn}. During the rendering of cells the renderer is fetched from ! * a {@code Hashtable} of entries according to the class of the cells in the column. If ! * there is no entry for this {@code columnClass} the method returns ! * the entry for the most specific superclass. The {@code JTable} installs entries ! * for {@code Object}, {@code Number}, and {@code Boolean}, all of which can be modified * or replaced. * * @param columnClass return the default cell renderer * for this columnClass * @return the renderer for this columnClass
*** 1360,1374 **** } } /** * Sets a default cell editor to be used if no editor has been set in ! * a <code>TableColumn</code>. If no editing is required in a table, or a ! * particular column in a table, uses the <code>isCellEditable</code> ! * method in the <code>TableModel</code> interface to ensure that this ! * <code>JTable</code> will not start an editor in these columns. ! * If editor is <code>null</code>, removes the default editor for this * column class. * * @param columnClass set the default cell editor for this columnClass * @param editor default cell editor to be used for this columnClass * @see TableModel#isCellEditable --- 1360,1374 ---- } } /** * Sets a default cell editor to be used if no editor has been set in ! * a {@code TableColumn}. If no editing is required in a table, or a ! * particular column in a table, uses the {@code isCellEditable} ! * method in the {@code TableModel} interface to ensure that this ! * {@code JTable} will not start an editor in these columns. ! * If editor is {@code null}, removes the default editor for this * column class. * * @param columnClass set the default cell editor for this columnClass * @param editor default cell editor to be used for this columnClass * @see TableModel#isCellEditable
*** 1384,1398 **** } } /** * Returns the editor to be used when no editor has been set in ! * a <code>TableColumn</code>. During the editing of cells the editor is fetched from ! * a <code>Hashtable</code> of entries according to the class of the cells in the column. If ! * there is no entry for this <code>columnClass</code> the method returns ! * the entry for the most specific superclass. The <code>JTable</code> installs entries ! * for <code>Object</code>, <code>Number</code>, and <code>Boolean</code>, all of which can be modified * or replaced. * * @param columnClass return the default cell editor for this columnClass * @return the default cell editor to be used for this columnClass * @see #setDefaultEditor --- 1384,1398 ---- } } /** * Returns the editor to be used when no editor has been set in ! * a {@code TableColumn}. During the editing of cells the editor is fetched from ! * a {@code Hashtable} of entries according to the class of the cells in the column. If ! * there is no entry for this {@code columnClass} the method returns ! * the entry for the most specific superclass. The {@code JTable} installs entries ! * for {@code Object}, {@code Number}, and {@code Boolean}, all of which can be modified * or replaced. * * @param columnClass return the default cell editor for this columnClass * @return the default cell editor to be used for this columnClass * @see #setDefaultEditor
*** 1432,1444 **** * begin a drag and drop operation by calling {@code exportAsDrag} on the * table's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling * @exception HeadlessException if ! * <code>b</code> is <code>true</code> and ! * <code>GraphicsEnvironment.isHeadless()</code> ! * returns <code>true</code> * @see java.awt.GraphicsEnvironment#isHeadless * @see #getDragEnabled * @see #setTransferHandler * @see TransferHandler * @since 1.4 --- 1432,1444 ---- * begin a drag and drop operation by calling {@code exportAsDrag} on the * table's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling * @exception HeadlessException if ! * {@code b} is {@code true} and ! * {@code GraphicsEnvironment.isHeadless()} ! * returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless * @see #getDragEnabled * @see #setTransferHandler * @see TransferHandler * @since 1.4
*** 1469,1502 **** return dragEnabled; } /** * Sets the drop mode for this component. For backward compatibility, ! * the default for this property is <code>DropMode.USE_SELECTION</code>. * Usage of one of the other modes is recommended, however, for an ! * improved user experience. <code>DropMode.ON</code>, for instance, * offers similar behavior of showing items as selected, but does so without * affecting the actual selection in the table. * <p> ! * <code>JTable</code> supports the following drop modes: * <ul> ! * <li><code>DropMode.USE_SELECTION</code></li> ! * <li><code>DropMode.ON</code></li> ! * <li><code>DropMode.INSERT</code></li> ! * <li><code>DropMode.INSERT_ROWS</code></li> ! * <li><code>DropMode.INSERT_COLS</code></li> ! * <li><code>DropMode.ON_OR_INSERT</code></li> ! * <li><code>DropMode.ON_OR_INSERT_ROWS</code></li> ! * <li><code>DropMode.ON_OR_INSERT_COLS</code></li> * </ul> * <p> * The drop mode is only meaningful if this component has a ! * <code>TransferHandler</code> that accepts drops. * * @param dropMode the drop mode to use * @throws IllegalArgumentException if the drop mode is unsupported ! * or <code>null</code> * @see #getDropMode * @see #getDropLocation * @see #setTransferHandler * @see TransferHandler * @since 1.6 --- 1469,1502 ---- return dragEnabled; } /** * Sets the drop mode for this component. For backward compatibility, ! * the default for this property is {@code DropMode.USE_SELECTION}. * Usage of one of the other modes is recommended, however, for an ! * improved user experience. {@code DropMode.ON}, for instance, * offers similar behavior of showing items as selected, but does so without * affecting the actual selection in the table. * <p> ! * {@code JTable} supports the following drop modes: * <ul> ! * <li>{@code DropMode.USE_SELECTION}</li> ! * <li>{@code DropMode.ON}</li> ! * <li>{@code DropMode.INSERT}</li> ! * <li>{@code DropMode.INSERT_ROWS}</li> ! * <li>{@code DropMode.INSERT_COLS}</li> ! * <li>{@code DropMode.ON_OR_INSERT}</li> ! * <li>{@code DropMode.ON_OR_INSERT_ROWS}</li> ! * <li>{@code DropMode.ON_OR_INSERT_COLS}</li> * </ul> * <p> * The drop mode is only meaningful if this component has a ! * {@code TransferHandler} that accepts drops. * * @param dropMode the drop mode to use * @throws IllegalArgumentException if the drop mode is unsupported ! * or {@code null} * @see #getDropMode * @see #getDropLocation * @see #setTransferHandler * @see TransferHandler * @since 1.6
*** 1537,1547 **** /** * Calculates a drop location in this component, representing where a * drop at the given point should insert data. * * @param p the point to calculate a drop location for ! * @return the drop location, or <code>null</code> */ DropLocation dropLocationForPoint(Point p) { DropLocation location = null; int row = rowAtPoint(p); --- 1537,1547 ---- /** * Calculates a drop location in this component, representing where a * drop at the given point should insert data. * * @param p the point to calculate a drop location for ! * @return the drop location, or {@code null} */ DropLocation dropLocationForPoint(Point p) { DropLocation location = null; int row = rowAtPoint(p);
*** 1733,1756 **** * a drop index). It can return a state object to the caller encapsulating * any saved selection state. On a second call, let's say the drop location * is being changed to something else. The component doesn't need to * restore anything yet, so it simply passes back the same state object * to have the DnD system continue storing it. Finally, let's say this ! * method is messaged with <code>null</code>. This means DnD * is finished with this component for now, meaning it should restore * state. At this point, it can use the state parameter to restore ! * said state, and of course return <code>null</code> since there's * no longer anything to store. * * @param location the drop location (as calculated by ! * <code>dropLocationForPoint</code>) or <code>null</code> * if there's no longer a valid drop location * @param state the state object saved earlier for this component, ! * or <code>null</code> * @param forDrop whether or not the method is being called because an * actual drop occurred ! * @return any saved state for this component, or <code>null</code> if none */ Object setDropLocation(TransferHandler.DropLocation location, Object state, boolean forDrop) { --- 1733,1756 ---- * a drop index). It can return a state object to the caller encapsulating * any saved selection state. On a second call, let's say the drop location * is being changed to something else. The component doesn't need to * restore anything yet, so it simply passes back the same state object * to have the DnD system continue storing it. Finally, let's say this ! * method is messaged with {@code null}. This means DnD * is finished with this component for now, meaning it should restore * state. At this point, it can use the state parameter to restore ! * said state, and of course return {@code null} since there's * no longer anything to store. * * @param location the drop location (as calculated by ! * {@code dropLocationForPoint}) or {@code null} * if there's no longer a valid drop location * @param state the state object saved earlier for this component, ! * or {@code null} * @param forDrop whether or not the method is being called because an * actual drop occurred ! * @return any saved state for this component, or {@code null} if none */ Object setDropLocation(TransferHandler.DropLocation location, Object state, boolean forDrop) {
*** 1821,1831 **** * as the drop location during a DnD operation over the component, * or {@code null} if no location is to currently be shown. * <p> * This method is not meant for querying the drop location * from a {@code TransferHandler}, as the drop location is only ! * set after the {@code TransferHandler}'s <code>canImport</code> * has returned and has allowed for the location to be shown. * <p> * When this property changes, a property change event with * name "dropLocation" is fired by the component. * --- 1821,1831 ---- * as the drop location during a DnD operation over the component, * or {@code null} if no location is to currently be shown. * <p> * This method is not meant for querying the drop location * from a {@code TransferHandler}, as the drop location is only ! * set after the {@code TransferHandler}'s {@code canImport} * has returned and has allowed for the location to be shown. * <p> * When this property changes, a property change event with * name "dropLocation" is fired by the component. *
*** 1911,1934 **** public boolean getUpdateSelectionOnSort() { return updateSelectionOnSort; } /** ! * Sets the <code>RowSorter</code>. <code>RowSorter</code> is used ! * to provide sorting and filtering to a <code>JTable</code>. * <p> * This method clears the selection and resets any variable row heights. * <p> ! * This method fires a <code>PropertyChangeEvent</code> when appropriate, ! * with the property name <code>"rowSorter"</code>. For * backward-compatibility, this method fires an additional event with the ! * property name <code>"sorter"</code>. * <p> ! * If the underlying model of the <code>RowSorter</code> differs from ! * 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 --- 1911,1934 ---- public boolean getUpdateSelectionOnSort() { return updateSelectionOnSort; } /** ! * Sets the {@code RowSorter}. {@code RowSorter} is used ! * to provide sorting and filtering to a {@code JTable}. * <p> * This method clears the selection and resets any variable row heights. * <p> ! * This method fires a {@code PropertyChangeEvent} when appropriate, ! * with the property name {@code "rowSorter"}. For * backward-compatibility, this method fires an additional event with the ! * property name {@code "sorter"}. * <p> ! * If the underlying model of the {@code RowSorter} differs from ! * that of this {@code JTable} undefined behavior will result. * ! * @param sorter the {@code RowSorter}; {@code null} turns * sorting off * @see javax.swing.table.TableRowSorter * @beaninfo * bound: true * description: The table's RowSorter
*** 1967,1989 **** /** * Sets the table's selection mode to allow only single selections, a single * contiguous interval, or multiple intervals. * <P> * <b>Note:</b> ! * <code>JTable</code> provides all the methods for handling * column and row selection. When setting states, ! * such as <code>setSelectionMode</code>, it not only * updates the mode for the row selection model but also sets similar ! * values in the selection model of the <code>columnModel</code>. * If you want to have the row and column selection models operating * in different modes, set them both directly. * <p> ! * Both the row and column selection models for <code>JTable</code> ! * default to using a <code>DefaultListSelectionModel</code> ! * so that <code>JTable</code> works the same way as the ! * <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. --- 1967,1989 ---- /** * Sets the table's selection mode to allow only single selections, a single * contiguous interval, or multiple intervals. * <P> * <b>Note:</b> ! * {@code JTable} provides all the methods for handling * column and row selection. When setting states, ! * such as {@code setSelectionMode}, it not only * updates the mode for the row selection model but also sets similar ! * values in the selection model of the {@code columnModel}. * If you want to have the row and column selection models operating * in different modes, set them both directly. * <p> ! * Both the row and column selection models for {@code JTable} ! * default to using a {@code DefaultListSelectionModel} ! * so that {@code JTable} works the same way as the ! * {@code JList}. See the {@code setSelectionMode} method ! * in {@code JList} 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.
*** 2057,2071 **** /** * Sets whether this table allows both a column selection and a * row selection to exist simultaneously. When set, * the table treats the intersection of the row and column selection ! * models as the selected cells. Override <code>isCellSelected</code> to * change this default behavior. This method is equivalent to setting ! * both the <code>rowSelectionAllowed</code> property and ! * <code>columnSelectionAllowed</code> property of the ! * <code>columnModel</code> to the supplied value. * * @param cellSelectionEnabled true if simultaneous row and column * selection is allowed * @see #getCellSelectionEnabled * @see #isCellSelected --- 2057,2071 ---- /** * Sets whether this table allows both a column selection and a * row selection to exist simultaneously. When set, * the table treats the intersection of the row and column selection ! * models as the selected cells. Override {@code isCellSelected} to * change this default behavior. This method is equivalent to setting ! * both the {@code rowSelectionAllowed} property and ! * {@code columnSelectionAllowed} property of the ! * {@code columnModel} to the supplied value. * * @param cellSelectionEnabled true if simultaneous row and column * selection is allowed * @see #getCellSelectionEnabled * @see #isCellSelected
*** 2083,2094 **** firePropertyChange("cellSelectionEnabled", old, cellSelectionEnabled); } /** * Returns true if both row and column selection models are enabled. ! * Equivalent to <code>getRowSelectionAllowed() &amp;&amp; ! * getColumnSelectionAllowed()</code>. * * @return true if both row and column selection models are enabled * * @see #setCellSelectionEnabled */ --- 2083,2094 ---- firePropertyChange("cellSelectionEnabled", old, cellSelectionEnabled); } /** * Returns true if both row and column selection models are enabled. ! * Equivalent to ! * {@code getRowSelectionAllowed() && getColumnSelectionAllowed()}. * * @return true if both row and column selection models are enabled * * @see #setCellSelectionEnabled */
*** 2176,2258 **** } return col; } /** ! * Selects the rows from <code>index0</code> to <code>index1</code>, * inclusive. * ! * @exception IllegalArgumentException if <code>index0</code> or ! * <code>index1</code> lie outside ! * [0, <code>getRowCount()</code>-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void setRowSelectionInterval(int index0, int index1) { selectionModel.setSelectionInterval(boundRow(index0), boundRow(index1)); } /** ! * Selects the columns from <code>index0</code> to <code>index1</code>, * inclusive. * ! * @exception IllegalArgumentException if <code>index0</code> or ! * <code>index1</code> lie outside ! * [0, <code>getColumnCount()</code>-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void setColumnSelectionInterval(int index0, int index1) { columnModel.getSelectionModel().setSelectionInterval(boundColumn(index0), boundColumn(index1)); } /** ! * Adds the rows from <code>index0</code> to <code>index1</code>, inclusive, to * the current selection. * ! * @exception IllegalArgumentException if <code>index0</code> or <code>index1</code> ! * lie outside [0, <code>getRowCount()</code>-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void addRowSelectionInterval(int index0, int index1) { selectionModel.addSelectionInterval(boundRow(index0), boundRow(index1)); } /** ! * Adds the columns from <code>index0</code> to <code>index1</code>, * inclusive, to the current selection. * ! * @exception IllegalArgumentException if <code>index0</code> or ! * <code>index1</code> lie outside ! * [0, <code>getColumnCount()</code>-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void addColumnSelectionInterval(int index0, int index1) { columnModel.getSelectionModel().addSelectionInterval(boundColumn(index0), boundColumn(index1)); } /** ! * Deselects the rows from <code>index0</code> to <code>index1</code>, inclusive. * ! * @exception IllegalArgumentException if <code>index0</code> or ! * <code>index1</code> lie outside ! * [0, <code>getRowCount()</code>-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void removeRowSelectionInterval(int index0, int index1) { selectionModel.removeSelectionInterval(boundRow(index0), boundRow(index1)); } /** ! * Deselects the columns from <code>index0</code> to <code>index1</code>, inclusive. * ! * @exception IllegalArgumentException if <code>index0</code> or ! * <code>index1</code> lie outside ! * [0, <code>getColumnCount()</code>-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void removeColumnSelectionInterval(int index0, int index1) { columnModel.getSelectionModel().removeSelectionInterval(boundColumn(index0), boundColumn(index1)); --- 2176,2258 ---- } return col; } /** ! * Selects the rows from {@code index0} to {@code index1}, * inclusive. * ! * @exception IllegalArgumentException if {@code index0} or ! * {@code index1} lie outside ! * [0, {@code getRowCount()}-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void setRowSelectionInterval(int index0, int index1) { selectionModel.setSelectionInterval(boundRow(index0), boundRow(index1)); } /** ! * Selects the columns from {@code index0} to {@code index1}, * inclusive. * ! * @exception IllegalArgumentException if {@code index0} or ! * {@code index1} lie outside ! * [0, {@code getColumnCount()}-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void setColumnSelectionInterval(int index0, int index1) { columnModel.getSelectionModel().setSelectionInterval(boundColumn(index0), boundColumn(index1)); } /** ! * Adds the rows from {@code index0} to {@code index1}, inclusive, to * the current selection. * ! * @exception IllegalArgumentException if {@code index0} or {@code index1} ! * lie outside [0, {@code getRowCount()}-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void addRowSelectionInterval(int index0, int index1) { selectionModel.addSelectionInterval(boundRow(index0), boundRow(index1)); } /** ! * Adds the columns from {@code index0} to {@code index1}, * inclusive, to the current selection. * ! * @exception IllegalArgumentException if {@code index0} or ! * {@code index1} lie outside ! * [0, {@code getColumnCount()}-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void addColumnSelectionInterval(int index0, int index1) { columnModel.getSelectionModel().addSelectionInterval(boundColumn(index0), boundColumn(index1)); } /** ! * Deselects the rows from {@code index0} to {@code index1}, inclusive. * ! * @exception IllegalArgumentException if {@code index0} or ! * {@code index1} lie outside ! * [0, {@code getRowCount()}-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void removeRowSelectionInterval(int index0, int index1) { selectionModel.removeSelectionInterval(boundRow(index0), boundRow(index1)); } /** ! * Deselects the columns from {@code index0} to {@code index1}, inclusive. * ! * @exception IllegalArgumentException if {@code index0} or ! * {@code index1} lie outside ! * [0, {@code getColumnCount()}-1] * @param index0 one end of the interval * @param index1 the other end of the interval */ public void removeColumnSelectionInterval(int index0, int index1) { columnModel.getSelectionModel().removeSelectionInterval(boundColumn(index0), boundColumn(index1));
*** 2343,2353 **** /** * Returns true if the specified index is in the valid range of rows, * and the row at that index is selected. * * @param row a row in the row model ! * @return true if <code>row</code> is a valid index and the row at * that index is selected (where 0 is the first row) */ public boolean isRowSelected(int row) { return selectionModel.isSelectedIndex(row); } --- 2343,2353 ---- /** * Returns true if the specified index is in the valid range of rows, * and the row at that index is selected. * * @param row a row in the row model ! * @return true if {@code row} is a valid index and the row at * that index is selected (where 0 is the first row) */ public boolean isRowSelected(int row) { return selectionModel.isSelectedIndex(row); }
*** 2355,2365 **** /** * Returns true if the specified index is in the valid range of columns, * and the column at that index is selected. * * @param column the column in the column model ! * @return true if <code>column</code> is a valid index and the column at * that index is selected (where 0 is the first column) */ public boolean isColumnSelected(int column) { return columnModel.getSelectionModel().isSelectedIndex(column); } --- 2355,2365 ---- /** * Returns true if the specified index is in the valid range of columns, * and the column at that index is selected. * * @param column the column in the column model ! * @return true if {@code column} is a valid index and the column at * that index is selected (where 0 is the first column) */ public boolean isColumnSelected(int column) { return columnModel.getSelectionModel().isSelectedIndex(column); }
*** 2368,2379 **** * Returns true if the specified indices are in the valid range of rows * and columns and the cell at the specified position is selected. * @param row the row being queried * @param column the column being queried * ! * @return true if <code>row</code> and <code>column</code> are valid indices ! * and the cell at index <code>(row, column)</code> is selected, * where the first row and first column are at index 0 */ public boolean isCellSelected(int row, int column) { if (!getRowSelectionAllowed() && !getColumnSelectionAllowed()) { return false; --- 2368,2379 ---- * Returns true if the specified indices are in the valid range of rows * and columns and the cell at the specified position is selected. * @param row the row being queried * @param column the column being queried * ! * @return true if {@code row} and {@code column} are valid indices ! * and the cell at index {@code (row, column)} is selected, * where the first row and first column are at index 0 */ public boolean isCellSelected(int row, int column) { if (!getRowSelectionAllowed() && !getColumnSelectionAllowed()) { return false;
*** 2417,2448 **** } } /** * Updates the selection models of the table, depending on the state of the ! * two flags: <code>toggle</code> and <code>extend</code>. Most changes * to the selection that are the result of keyboard or mouse events received * by the UI are channeled through this method so that the behavior may be * overridden by a subclass. Some UIs may need more functionality than * this method provides, such as when manipulating the lead for discontiguous * selection, and may not call into this method for some selection changes. * <p> * This implementation uses the following conventions: * <ul> ! * <li> <code>toggle</code>: <em>false</em>, <code>extend</code>: <em>false</em>. * Clear the previous selection and ensure the new cell is selected. ! * <li> <code>toggle</code>: <em>false</em>, <code>extend</code>: <em>true</em>. * Extend the previous selection from the anchor to the specified cell, * clearing all other selections. ! * <li> <code>toggle</code>: <em>true</em>, <code>extend</code>: <em>false</em>. * If the specified cell is selected, deselect it. If it is not selected, select it. ! * <li> <code>toggle</code>: <em>true</em>, <code>extend</code>: <em>true</em>. * Apply the selection state of the anchor to all cells between it and the * specified cell. * </ul> ! * @param rowIndex affects the selection at <code>row</code> ! * @param columnIndex affects the selection at <code>column</code> * @param toggle see description above * @param extend if true, extend the current selection * * @since 1.3 */ --- 2417,2448 ---- } } /** * Updates the selection models of the table, depending on the state of the ! * two flags: {@code toggle} and {@code extend}. Most changes * to the selection that are the result of keyboard or mouse events received * by the UI are channeled through this method so that the behavior may be * overridden by a subclass. Some UIs may need more functionality than * this method provides, such as when manipulating the lead for discontiguous * selection, and may not call into this method for some selection changes. * <p> * This implementation uses the following conventions: * <ul> ! * <li> {@code toggle}: <em>false</em>, {@code extend}: <em>false</em>. * Clear the previous selection and ensure the new cell is selected. ! * <li> {@code toggle}: <em>false</em>, {@code extend}: <em>true</em>. * Extend the previous selection from the anchor to the specified cell, * clearing all other selections. ! * <li> {@code toggle}: <em>true</em>, {@code extend}: <em>false</em>. * If the specified cell is selected, deselect it. If it is not selected, select it. ! * <li> {@code toggle}: <em>true</em>, {@code extend}: <em>true</em>. * Apply the selection state of the anchor to all cells between it and the * specified cell. * </ul> ! * @param rowIndex affects the selection at {@code row} ! * @param columnIndex affects the selection at {@code column} * @param toggle see description above * @param extend if true, extend the current selection * * @since 1.3 */
*** 2496,2506 **** } /** * Returns the foreground color for selected cells. * ! * @return the <code>Color</code> object for the foreground property * @see #setSelectionForeground * @see #setSelectionBackground */ public Color getSelectionForeground() { return selectionForeground; --- 2496,2506 ---- } /** * Returns the foreground color for selected cells. * ! * @return the {@code Color} object for the foreground property * @see #setSelectionForeground * @see #setSelectionBackground */ public Color getSelectionForeground() { return selectionForeground;
*** 2514,2524 **** * The default value of this property is defined by the look * and feel implementation. * <p> * This is a <a href="http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html">JavaBeans</a> bound property. * ! * @param selectionForeground the <code>Color</code> to use in the foreground * for selected list items * @see #getSelectionForeground * @see #setSelectionBackground * @see #setForeground * @see #setBackground --- 2514,2524 ---- * The default value of this property is defined by the look * and feel implementation. * <p> * This is a <a href="http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html">JavaBeans</a> bound property. * ! * @param selectionForeground the {@code Color} to use in the foreground * for selected list items * @see #getSelectionForeground * @see #setSelectionBackground * @see #setForeground * @see #setBackground
*** 2535,2545 **** } /** * Returns the background color for selected cells. * ! * @return the <code>Color</code> used for the background of selected list items * @see #setSelectionBackground * @see #setSelectionForeground */ public Color getSelectionBackground() { return selectionBackground; --- 2535,2545 ---- } /** * Returns the background color for selected cells. * ! * @return the {@code Color} used for the background of selected list items * @see #setSelectionBackground * @see #setSelectionForeground */ public Color getSelectionBackground() { return selectionBackground;
*** 2552,2562 **** * The default value of this property is defined by the look * and feel implementation. * <p> * This is a <a href="http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html">JavaBeans</a> bound property. * ! * @param selectionBackground the <code>Color</code> to use for the background * of selected cells * @see #getSelectionBackground * @see #setSelectionForeground * @see #setForeground * @see #setBackground --- 2552,2562 ---- * The default value of this property is defined by the look * and feel implementation. * <p> * This is a <a href="http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html">JavaBeans</a> bound property. * ! * @param selectionBackground the {@code Color} to use for the background * of selected cells * @see #getSelectionBackground * @see #setSelectionForeground * @see #setForeground * @see #setBackground
*** 2571,2586 **** firePropertyChange("selectionBackground", old, selectionBackground); repaint(); } /** ! * Returns the <code>TableColumn</code> object for the column in the table ! * whose identifier is equal to <code>identifier</code>, when compared using ! * <code>equals</code>. * ! * @return the <code>TableColumn</code> object that matches the identifier ! * @exception IllegalArgumentException if <code>identifier</code> is <code>null</code> or no <code>TableColumn</code> has this identifier * * @param identifier the identifier object */ public TableColumn getColumn(Object identifier) { TableColumnModel cm = getColumnModel(); --- 2571,2586 ---- firePropertyChange("selectionBackground", old, selectionBackground); repaint(); } /** ! * Returns the {@code TableColumn} object for the column in the table ! * whose identifier is equal to {@code identifier}, when compared using ! * {@code equals}. * ! * @return the {@code TableColumn} object that matches the identifier ! * @exception IllegalArgumentException if {@code identifier} is {@code null} or no {@code TableColumn} has this identifier * * @param identifier the identifier object */ public TableColumn getColumn(Object identifier) { TableColumnModel cm = getColumnModel();
*** 2592,2605 **** // Informally implement the TableModel interface. // /** * Maps the index of the column in the view at ! * <code>viewColumnIndex</code> to the index of the column * in the table model. Returns the index of the corresponding ! * column in the model. If <code>viewColumnIndex</code> ! * is less than zero, returns <code>viewColumnIndex</code>. * * @param viewColumnIndex the index of the column in the view * @return the index of the corresponding column in the model * * @see #convertColumnIndexToView --- 2592,2605 ---- // Informally implement the TableModel interface. // /** * Maps the index of the column in the view at ! * {@code viewColumnIndex} to the index of the column * in the table model. Returns the index of the corresponding ! * column in the model. If {@code viewColumnIndex} ! * is less than zero, returns {@code viewColumnIndex}. * * @param viewColumnIndex the index of the column in the view * @return the index of the corresponding column in the model * * @see #convertColumnIndexToView
*** 2609,2623 **** getColumnModel(), viewColumnIndex); } /** * Maps the index of the column in the table model at ! * <code>modelColumnIndex</code> to the index of the column * in the view. Returns the index of the * corresponding column in the view; returns -1 if this column is not ! * being displayed. If <code>modelColumnIndex</code> is less than zero, ! * returns <code>modelColumnIndex</code>. * * @param modelColumnIndex the index of the column in the model * @return the index of the corresponding column in the view * * @see #convertColumnIndexToModel --- 2609,2623 ---- getColumnModel(), viewColumnIndex); } /** * Maps the index of the column in the table model at ! * {@code modelColumnIndex} to the index of the column * in the view. Returns the index of the * corresponding column in the view; returns -1 if this column is not ! * being displayed. If {@code modelColumnIndex} is less than zero, ! * returns {@code modelColumnIndex}. * * @param modelColumnIndex the index of the column in the model * @return the index of the corresponding column in the view * * @see #convertColumnIndexToModel
*** 2627,2644 **** getColumnModel(), modelColumnIndex); } /** * Maps the index of the row in terms of the ! * <code>TableModel</code> to the view. If the contents of the * model are not sorted the model and view indices are the same. * * @param modelRowIndex the index of the row in terms of the model * @return the index of the corresponding row in the view, or -1 if * the row isn't visible * @throws IndexOutOfBoundsException if sorting is enabled and passed an ! * index outside the number of rows of the <code>TableModel</code> * @see javax.swing.table.TableRowSorter * @since 1.6 */ public int convertRowIndexToView(int modelRowIndex) { RowSorter<?> sorter = getRowSorter(); --- 2627,2644 ---- getColumnModel(), modelColumnIndex); } /** * Maps the index of the row in terms of the ! * {@code TableModel} to the view. If the contents of the * model are not sorted the model and view indices are the same. * * @param modelRowIndex the index of the row in terms of the model * @return the index of the corresponding row in the view, or -1 if * the row isn't visible * @throws IndexOutOfBoundsException if sorting is enabled and passed an ! * index outside the number of rows of the {@code TableModel} * @see javax.swing.table.TableRowSorter * @since 1.6 */ public int convertRowIndexToView(int modelRowIndex) { RowSorter<?> sorter = getRowSorter();
*** 2648,2665 **** return modelRowIndex; } /** * Maps the index of the row in terms of the view to the ! * underlying <code>TableModel</code>. If the contents of the * model are not sorted the model and view indices are the same. * * @param viewRowIndex the index of the row in the view * @return the index of the corresponding row in the model * @throws IndexOutOfBoundsException if sorting is enabled and passed an ! * index outside the range of the <code>JTable</code> as ! * determined by the method <code>getRowCount</code> * @see javax.swing.table.TableRowSorter * @see #getRowCount * @since 1.6 */ public int convertRowIndexToModel(int viewRowIndex) { --- 2648,2665 ---- return modelRowIndex; } /** * Maps the index of the row in terms of the view to the ! * underlying {@code TableModel}. If the contents of the * model are not sorted the model and view indices are the same. * * @param viewRowIndex the index of the row in the view * @return the index of the corresponding row in the model * @throws IndexOutOfBoundsException if sorting is enabled and passed an ! * index outside the range of the {@code JTable} as ! * determined by the method {@code getRowCount} * @see javax.swing.table.TableRowSorter * @see #getRowCount * @since 1.6 */ public int convertRowIndexToModel(int viewRowIndex) {
*** 2670,2685 **** return viewRowIndex; } /** * Returns the number of rows that can be shown in the ! * <code>JTable</code>, given unlimited space. If a ! * <code>RowSorter</code> with a filter has been specified, the * number of rows returned may differ from that of the underlying ! * <code>TableModel</code>. * ! * @return the number of rows shown in the <code>JTable</code> * @see #getColumnCount */ public int getRowCount() { RowSorter<?> sorter = getRowSorter(); if (sorter != null) { --- 2670,2685 ---- return viewRowIndex; } /** * Returns the number of rows that can be shown in the ! * {@code JTable}, given unlimited space. If a ! * {@code RowSorter} with a filter has been specified, the * number of rows returned may differ from that of the underlying ! * {@code TableModel}. * ! * @return the number of rows shown in the {@code JTable} * @see #getColumnCount */ public int getRowCount() { RowSorter<?> sorter = getRowSorter(); if (sorter != null) {
*** 2700,2736 **** return getColumnModel().getColumnCount(); } /** * Returns the name of the column appearing in the view at ! * column position <code>column</code>. * * @param column the column in the view being queried ! * @return the name of the column at position <code>column</code> in the view where the first column is column 0 */ public String getColumnName(int column) { return getModel().getColumnName(convertColumnIndexToModel(column)); } /** * Returns the type of the column appearing in the view at ! * column position <code>column</code>. * * @param column the column in the view being queried ! * @return the type of the column at position <code>column</code> * in the view where the first column is column 0 */ public Class<?> getColumnClass(int column) { return getModel().getColumnClass(convertColumnIndexToModel(column)); } /** ! * Returns the cell value at <code>row</code> and <code>column</code>. * <p> * <b>Note</b>: The column is specified in the table view's display ! * order, and not in the <code>TableModel</code>'s column * order. This is an important distinction because as the * user rearranges the columns in the table, * the column at a given index in the view will change. * Meanwhile the user's actions never affect the model's * column ordering. --- 2700,2736 ---- return getColumnModel().getColumnCount(); } /** * Returns the name of the column appearing in the view at ! * column position {@code column}. * * @param column the column in the view being queried ! * @return the name of the column at position {@code column} in the view where the first column is column 0 */ public String getColumnName(int column) { return getModel().getColumnName(convertColumnIndexToModel(column)); } /** * Returns the type of the column appearing in the view at ! * column position {@code column}. * * @param column the column in the view being queried ! * @return the type of the column at position {@code column} * in the view where the first column is column 0 */ public Class<?> getColumnClass(int column) { return getModel().getColumnClass(convertColumnIndexToModel(column)); } /** ! * Returns the cell value at {@code row} and {@code column}. * <p> * <b>Note</b>: The column is specified in the table view's display ! * order, and not in the {@code TableModel}'s column * order. This is an important distinction because as the * user rearranges the columns in the table, * the column at a given index in the view will change. * Meanwhile the user's actions never affect the model's * column ordering.
*** 2743,2764 **** return getModel().getValueAt(convertRowIndexToModel(row), convertColumnIndexToModel(column)); } /** ! * Sets the value for the cell in the table model at <code>row</code> ! * and <code>column</code>. * <p> * <b>Note</b>: The column is specified in the table view's display ! * order, and not in the <code>TableModel</code>'s column * order. This is an important distinction because as the * user rearranges the columns in the table, * the column at a given index in the view will change. * Meanwhile the user's actions never affect the model's * column ordering. * ! * <code>aValue</code> is the new value. * * @param aValue the new value * @param row the row of the cell to be changed * @param column the column of the cell to be changed * @see #getValueAt --- 2743,2764 ---- return getModel().getValueAt(convertRowIndexToModel(row), convertColumnIndexToModel(column)); } /** ! * Sets the value for the cell in the table model at {@code row} ! * and {@code column}. * <p> * <b>Note</b>: The column is specified in the table view's display ! * order, and not in the {@code TableModel}'s column * order. This is an important distinction because as the * user rearranges the columns in the table, * the column at a given index in the view will change. * Meanwhile the user's actions never affect the model's * column ordering. * ! * {@code aValue} is the new value. * * @param aValue the new value * @param row the row of the cell to be changed * @param column the column of the cell to be changed * @see #getValueAt
*** 2767,2782 **** getModel().setValueAt(aValue, convertRowIndexToModel(row), convertColumnIndexToModel(column)); } /** ! * Returns true if the cell at <code>row</code> and <code>column</code> ! * is editable. Otherwise, invoking <code>setValueAt</code> on the cell * will have no effect. * <p> * <b>Note</b>: The column is specified in the table view's display ! * order, and not in the <code>TableModel</code>'s column * order. This is an important distinction because as the * user rearranges the columns in the table, * the column at a given index in the view will change. * Meanwhile the user's actions never affect the model's * column ordering. --- 2767,2782 ---- getModel().setValueAt(aValue, convertRowIndexToModel(row), convertColumnIndexToModel(column)); } /** ! * Returns true if the cell at {@code row} and {@code column} ! * is editable. Otherwise, invoking {@code setValueAt} on the cell * will have no effect. * <p> * <b>Note</b>: The column is specified in the table view's display ! * order, and not in the {@code TableModel}'s column * order. This is an important distinction because as the * user rearranges the columns in the table, * the column at a given index in the view will change. * Meanwhile the user's actions never affect the model's * column ordering.
*** 2794,2826 **** // // Adding and removing columns in the view // /** ! * Appends <code>aColumn</code> to the end of the array of columns held by ! * this <code>JTable</code>'s column model. ! * If the column name of <code>aColumn</code> is <code>null</code>, ! * sets the column name of <code>aColumn</code> to the name ! * returned by <code>getModel().getColumnName()</code>. ! * <p> ! * To add a column to this <code>JTable</code> to display the ! * <code>modelColumn</code>'th column of data in the model with a ! * given <code>width</code>, <code>cellRenderer</code>, ! * and <code>cellEditor</code> you can use: * <pre> * * addColumn(new TableColumn(modelColumn, width, cellRenderer, cellEditor)); * * </pre> ! * [Any of the <code>TableColumn</code> constructors can be used * instead of this one.] ! * The model column number is stored inside the <code>TableColumn</code> * and is used during rendering and editing to locate the appropriates * data values in the model. The model column number does not change * when columns are reordered in the view. * ! * @param aColumn the <code>TableColumn</code> to be added * @see #removeColumn */ public void addColumn(TableColumn aColumn) { if (aColumn.getHeaderValue() == null) { int modelColumn = aColumn.getModelIndex(); --- 2794,2826 ---- // // Adding and removing columns in the view // /** ! * Appends {@code aColumn} to the end of the array of columns held by ! * this {@code JTable}'s column model. ! * If the column name of {@code aColumn} is {@code null}, ! * sets the column name of {@code aColumn} to the name ! * returned by {@code getModel().getColumnName()}. ! * <p> ! * To add a column to this {@code JTable} to display the ! * {@code modelColumn}'th column of data in the model with a ! * given {@code width}, {@code cellRenderer}, ! * and {@code cellEditor} you can use: * <pre> * * addColumn(new TableColumn(modelColumn, width, cellRenderer, cellEditor)); * * </pre> ! * [Any of the {@code TableColumn} constructors can be used * instead of this one.] ! * The model column number is stored inside the {@code TableColumn} * and is used during rendering and editing to locate the appropriates * data values in the model. The model column number does not change * when columns are reordered in the view. * ! * @param aColumn the {@code TableColumn} to be added * @see #removeColumn */ public void addColumn(TableColumn aColumn) { if (aColumn.getHeaderValue() == null) { int modelColumn = aColumn.getModelIndex();
*** 2829,2854 **** } getColumnModel().addColumn(aColumn); } /** ! * Removes <code>aColumn</code> from this <code>JTable</code>'s * array of columns. Note: this method does not remove the column ! * of data from the model; it just removes the <code>TableColumn</code> * that was responsible for displaying it. * ! * @param aColumn the <code>TableColumn</code> to be removed * @see #addColumn */ public void removeColumn(TableColumn aColumn) { getColumnModel().removeColumn(aColumn); } /** ! * Moves the column <code>column</code> to the position currently ! * occupied by the column <code>targetColumn</code> in the view. ! * The old column at <code>targetColumn</code> is * shifted left or right to make room. * * @param column the index of column to be moved * @param targetColumn the new index of the column */ --- 2829,2854 ---- } getColumnModel().addColumn(aColumn); } /** ! * Removes {@code aColumn} from this {@code JTable}'s * array of columns. Note: this method does not remove the column ! * of data from the model; it just removes the {@code TableColumn} * that was responsible for displaying it. * ! * @param aColumn the {@code TableColumn} to be removed * @see #addColumn */ public void removeColumn(TableColumn aColumn) { getColumnModel().removeColumn(aColumn); } /** ! * Moves the column {@code column} to the position currently ! * occupied by the column {@code targetColumn} in the view. ! * The old column at {@code targetColumn} is * shifted left or right to make room. * * @param column the index of column to be moved * @param targetColumn the new index of the column */
*** 2859,2876 **** // // Cover methods for various models and helper methods // /** ! * Returns the index of the column that <code>point</code> lies in, * or -1 if the result is not in the range ! * [0, <code>getColumnCount()</code>-1]. * * @param point the location of interest ! * @return the index of the column that <code>point</code> lies in, * or -1 if the result is not in the range ! * [0, <code>getColumnCount()</code>-1] * @see #rowAtPoint */ public int columnAtPoint(Point point) { int x = point.x; if( !getComponentOrientation().isLeftToRight() ) { --- 2859,2876 ---- // // Cover methods for various models and helper methods // /** ! * Returns the index of the column that {@code point} lies in, * or -1 if the result is not in the range ! * [0, {@code getColumnCount()}-1]. * * @param point the location of interest ! * @return the index of the column that {@code point} lies in, * or -1 if the result is not in the range ! * [0, {@code getColumnCount()}-1] * @see #rowAtPoint */ public int columnAtPoint(Point point) { int x = point.x; if( !getComponentOrientation().isLeftToRight() ) {
*** 2878,2895 **** } return getColumnModel().getColumnIndexAtX(x); } /** ! * Returns the index of the row that <code>point</code> lies in, * or -1 if the result is not in the range ! * [0, <code>getRowCount()</code>-1]. * * @param point the location of interest ! * @return the index of the row that <code>point</code> lies in, * or -1 if the result is not in the range ! * [0, <code>getRowCount()</code>-1] * @see #columnAtPoint */ public int rowAtPoint(Point point) { int y = point.y; int result = (rowModel == null) ? y/getRowHeight() : rowModel.getIndex(y); --- 2878,2895 ---- } return getColumnModel().getColumnIndexAtX(x); } /** ! * Returns the index of the row that {@code point} lies in, * or -1 if the result is not in the range ! * [0, {@code getRowCount()}-1]. * * @param point the location of interest ! * @return the index of the row that {@code point} lies in, * or -1 if the result is not in the range ! * [0, {@code getRowCount()}-1] * @see #columnAtPoint */ public int rowAtPoint(Point point) { int y = point.y; int result = (rowModel == null) ? y/getRowHeight() : rowModel.getIndex(y);
*** 2904,2935 **** } } /** * Returns a rectangle for the cell that lies at the intersection of ! * <code>row</code> and <code>column</code>. ! * If <code>includeSpacing</code> is true then the value returned * has the full height and width of the row and column * specified. If it is false, the returned rectangle is inset by the * intercell spacing to return the true bounds of the rendering or * editing component as it will be set during rendering. * <p> * If the column index is valid but the row index is less * than zero the method returns a rectangle with the ! * <code>y</code> and <code>height</code> values set appropriately ! * and the <code>x</code> and <code>width</code> values both set * to zero. In general, when either the row or column indices indicate a * cell outside the appropriate range, the method returns a rectangle * depicting the closest edge of the closest cell that is within * the table's range. When both row and column indices are out * of range the returned rectangle covers the closest * point of the closest cell. * <p> * In all cases, calculations that use this method to calculate * results along one axis will not fail because of anomalies in * calculations along the other axis. When the cell is not valid ! * the <code>includeSpacing</code> parameter is ignored. * * @param row the row index where the desired cell * is located * @param column the column index where the desired cell * is located in the display; this is not --- 2904,2935 ---- } } /** * Returns a rectangle for the cell that lies at the intersection of ! * {@code row} and {@code column}. ! * If {@code includeSpacing} is true then the value returned * has the full height and width of the row and column * specified. If it is false, the returned rectangle is inset by the * intercell spacing to return the true bounds of the rendering or * editing component as it will be set during rendering. * <p> * If the column index is valid but the row index is less * than zero the method returns a rectangle with the ! * {@code y} and {@code height} values set appropriately ! * and the {@code x} and {@code width} values both set * to zero. In general, when either the row or column indices indicate a * cell outside the appropriate range, the method returns a rectangle * depicting the closest edge of the closest cell that is within * the table's range. When both row and column indices are out * of range the returned rectangle covers the closest * point of the closest cell. * <p> * In all cases, calculations that use this method to calculate * results along one axis will not fail because of anomalies in * calculations along the other axis. When the cell is not valid ! * the {@code includeSpacing} parameter is ignored. * * @param row the row index where the desired cell * is located * @param column the column index where the desired cell * is located in the display; this is not
*** 2943,2953 **** * computed by subtracting the intercell * spacing from the height and widths of * the column and row models * * @return the rectangle containing the cell at location ! * <code>row</code>,<code>column</code> * @see #getIntercellSpacing */ public Rectangle getCellRect(int row, int column, boolean includeSpacing) { Rectangle r = new Rectangle(); boolean valid = true; --- 2943,2953 ---- * computed by subtracting the intercell * spacing from the height and widths of * the column and row models * * @return the rectangle containing the cell at location ! * {@code row},{@code column} * @see #getIntercellSpacing */ public Rectangle getCellRect(int row, int column, boolean includeSpacing) { Rectangle r = new Rectangle(); boolean valid = true;
*** 3016,3049 **** /** * Causes this table to lay out its rows and columns. Overridden so * that columns can be resized to accommodate a change in the size of * a containing parent. * Resizes one or more of the columns in the table ! * so that the total width of all of this <code>JTable</code>'s * columns is equal to the width of the table. * <p> * Before the layout begins the method gets the ! * <code>resizingColumn</code> of the <code>tableHeader</code>. * When the method is called as a result of the resizing of an enclosing window, ! * the <code>resizingColumn</code> is <code>null</code>. This means that resizing ! * has taken place "outside" the <code>JTable</code> and the change - * or "delta" - should be distributed to all of the columns regardless ! * of this <code>JTable</code>'s automatic resize mode. * <p> ! * If the <code>resizingColumn</code> is not <code>null</code>, it is one of * the columns in the table that has changed size rather than * the table itself. In this case the auto-resize modes govern * the way the extra (or deficit) space is distributed * amongst the available columns. * <p> * The modes are: * <ul> * <li> AUTO_RESIZE_OFF: Don't automatically adjust the column's * widths at all. Use a horizontal scrollbar to accommodate the * columns when their sum exceeds the width of the ! * <code>Viewport</code>. If the <code>JTable</code> is not ! * enclosed in a <code>JScrollPane</code> this may * leave parts of the table invisible. * <li> AUTO_RESIZE_NEXT_COLUMN: Use just the column after the * resizing column. This results in the "boundary" or divider * between adjacent cells being independently adjustable. * <li> AUTO_RESIZE_SUBSEQUENT_COLUMNS: Use all columns after the --- 3016,3049 ---- /** * Causes this table to lay out its rows and columns. Overridden so * that columns can be resized to accommodate a change in the size of * a containing parent. * Resizes one or more of the columns in the table ! * so that the total width of all of this {@code JTable}'s * columns is equal to the width of the table. * <p> * Before the layout begins the method gets the ! * {@code resizingColumn} of the {@code tableHeader}. * When the method is called as a result of the resizing of an enclosing window, ! * the {@code resizingColumn} is {@code null}. This means that resizing ! * has taken place "outside" the {@code JTable} and the change - * or "delta" - should be distributed to all of the columns regardless ! * of this {@code JTable}'s automatic resize mode. * <p> ! * If the {@code resizingColumn} is not {@code null}, it is one of * the columns in the table that has changed size rather than * the table itself. In this case the auto-resize modes govern * the way the extra (or deficit) space is distributed * amongst the available columns. * <p> * The modes are: * <ul> * <li> AUTO_RESIZE_OFF: Don't automatically adjust the column's * widths at all. Use a horizontal scrollbar to accommodate the * columns when their sum exceeds the width of the ! * {@code Viewport}. If the {@code JTable} is not ! * enclosed in a {@code JScrollPane} this may * leave parts of the table invisible. * <li> AUTO_RESIZE_NEXT_COLUMN: Use just the column after the * resizing column. This results in the "boundary" or divider * between adjacent cells being independently adjustable. * <li> AUTO_RESIZE_SUBSEQUENT_COLUMNS: Use all columns after the
*** 3053,3090 **** * size of the last column only. If the bounds of the last column * prevent the desired size from being allocated, set the * width of the last column to the appropriate limit and make * no further adjustments. * <li> AUTO_RESIZE_ALL_COLUMNS: Spread the delta amongst all the columns ! * in the <code>JTable</code>, including the one that is being * adjusted. * </ul> * <p> ! * <b>Note:</b> When a <code>JTable</code> makes adjustments * to the widths of the columns it respects their minimum and * maximum values absolutely. It is therefore possible that, * even after this method is called, the total width of the columns * is still not equal to the width of the table. When this happens ! * the <code>JTable</code> does not put itself * in AUTO_RESIZE_OFF mode to bring up a scroll bar, or break other * commitments of its current auto-resize mode -- instead it * allows its bounds to be set larger (or smaller) than the total of the * column minimum or maximum, meaning, either that there * will not be enough room to display all of the columns, or that the ! * columns will not fill the <code>JTable</code>'s bounds. * These respectively, result in the clipping of some columns ! * or an area being painted in the <code>JTable</code>'s * background color during painting. * <p> * The mechanism for distributing the delta amongst the available ! * columns is provided in a private method in the <code>JTable</code> * class: * <pre> * adjustSizes(long targetSize, final Resizable3 r, boolean inverse) * </pre> * an explanation of which is provided in the following section. ! * <code>Resizable3</code> is a private * interface that allows any data structure containing a collection * of elements with a size, preferred size, maximum size and minimum size * to have its elements manipulated by the algorithm. * * <H3> Distributing the delta </H3> --- 3053,3090 ---- * size of the last column only. If the bounds of the last column * prevent the desired size from being allocated, set the * width of the last column to the appropriate limit and make * no further adjustments. * <li> AUTO_RESIZE_ALL_COLUMNS: Spread the delta amongst all the columns ! * in the {@code JTable}, including the one that is being * adjusted. * </ul> * <p> ! * <b>Note:</b> When a {@code JTable} makes adjustments * to the widths of the columns it respects their minimum and * maximum values absolutely. It is therefore possible that, * even after this method is called, the total width of the columns * is still not equal to the width of the table. When this happens ! * the {@code JTable} does not put itself * in AUTO_RESIZE_OFF mode to bring up a scroll bar, or break other * commitments of its current auto-resize mode -- instead it * allows its bounds to be set larger (or smaller) than the total of the * column minimum or maximum, meaning, either that there * will not be enough room to display all of the columns, or that the ! * columns will not fill the {@code JTable}'s bounds. * These respectively, result in the clipping of some columns ! * or an area being painted in the {@code JTable}'s * background color during painting. * <p> * The mechanism for distributing the delta amongst the available ! * columns is provided in a private method in the {@code JTable} * class: * <pre> * adjustSizes(long targetSize, final Resizable3 r, boolean inverse) * </pre> * an explanation of which is provided in the following section. ! * {@code Resizable3} is a private * interface that allows any data structure containing a collection * of elements with a size, preferred size, maximum size and minimum size * to have its elements manipulated by the algorithm. * * <H3> Distributing the delta </H3>
*** 3136,3151 **** * the aggregated rounding errors caused by doing this operation in finite * precision (using ints). To deal with this, the multiplying factor above, * is constantly recalculated and this takes account of the rounding * errors in the previous iterations. The result is an algorithm that * produces a set of integers whose values exactly sum to the supplied ! * <code>targetSize</code>, and does so by spreading the rounding * errors evenly over the given elements. * * <H4>When the MAX and MIN bounds are hit</H4> * <P> ! * When <code>targetSize</code> is outside the [MIN, MAX] range, * the algorithm sets all sizes to their appropriate limiting value * (maximum or minimum). * */ public void doLayout() { --- 3136,3151 ---- * the aggregated rounding errors caused by doing this operation in finite * precision (using ints). To deal with this, the multiplying factor above, * is constantly recalculated and this takes account of the rounding * errors in the previous iterations. The result is an algorithm that * produces a set of integers whose values exactly sum to the supplied ! * {@code targetSize}, and does so by spreading the rounding * errors evenly over the given elements. * * <H4>When the MAX and MIN bounds are hit</H4> * <P> ! * When {@code targetSize} is outside the [MIN, MAX] range, * the algorithm sets all sizes to their appropriate limiting value * (maximum or minimum). * */ public void doLayout() {
*** 3199,3209 **** /** * Sizes the table columns to fit the available space. * * @param lastColumnOnly determines whether to resize last column only * @deprecated As of Swing version 1.0.3, ! * replaced by <code>doLayout()</code>. * @see #doLayout */ @Deprecated public void sizeColumnsToFit(boolean lastColumnOnly) { int oldAutoResizeMode = autoResizeMode; --- 3199,3209 ---- /** * Sizes the table columns to fit the available space. * * @param lastColumnOnly determines whether to resize last column only * @deprecated As of Swing version 1.0.3, ! * replaced by {@code doLayout()}. * @see #doLayout */ @Deprecated public void sizeColumnsToFit(boolean lastColumnOnly) { int oldAutoResizeMode = autoResizeMode;
*** 3213,3223 **** setAutoResizeMode(oldAutoResizeMode); } /** * Obsolete as of Java 2 platform v1.4. Please use the ! * <code>doLayout()</code> method instead. * @param resizingColumn the column whose resizing made this adjustment * necessary or -1 if there is no such column * @see #doLayout */ public void sizeColumnsToFit(int resizingColumn) { --- 3213,3223 ---- setAutoResizeMode(oldAutoResizeMode); } /** * Obsolete as of Java 2 platform v1.4. Please use the ! * {@code doLayout()} method instead. * @param resizingColumn the column whose resizing made this adjustment * necessary or -1 if there is no such column * @see #doLayout */ public void sizeColumnsToFit(int resizingColumn) {
*** 3389,3409 **** totalUpperBound -= upperBound; } } /** ! * Overrides <code>JComponent</code>'s <code>getToolTipText</code> * method in order to allow the renderer's tips to be used * if it has text set. * <p> ! * <b>Note:</b> For <code>JTable</code> to properly display * tooltips of its renderers ! * <code>JTable</code> must be a registered component with the ! * <code>ToolTipManager</code>. ! * This is done automatically in <code>initializeLocalVars</code>, ! * but if at a later point <code>JTable</code> is told ! * <code>setToolTipText(null)</code> it will unregister the table * component, and no tips from renderers will display anymore. * * @see JComponent#getToolTipText */ public String getToolTipText(MouseEvent event) { --- 3389,3409 ---- totalUpperBound -= upperBound; } } /** ! * Overrides {@code JComponent}'s {@code getToolTipText} * method in order to allow the renderer's tips to be used * if it has text set. * <p> ! * <b>Note:</b> For {@code JTable} to properly display * tooltips of its renderers ! * {@code JTable} must be a registered component with the ! * {@code ToolTipManager}. ! * This is done automatically in {@code initializeLocalVars}, ! * but if at a later point {@code JTable} is told ! * {@code setToolTipText(null)} it will unregister the table * component, and no tips from renderers will display anymore. * * @see JComponent#getToolTipText */ public String getToolTipText(MouseEvent event) {
*** 3481,3495 **** public boolean getSurrendersFocusOnKeystroke() { return surrendersFocusOnKeystroke; } /** ! * Programmatically starts editing the cell at <code>row</code> and ! * <code>column</code>, if those indices are in the valid range, and * the cell at those indices is editable. * Note that this is a convenience method for ! * <code>editCellAt(int, int, null)</code>. * * @param row the row to be edited * @param column the column to be edited * @return false if for any reason the cell cannot be edited, * or if the indices are invalid --- 3481,3495 ---- public boolean getSurrendersFocusOnKeystroke() { return surrendersFocusOnKeystroke; } /** ! * Programmatically starts editing the cell at {@code row} and ! * {@code column}, if those indices are in the valid range, and * the cell at those indices is editable. * Note that this is a convenience method for ! * {@code editCellAt(int, int, null)}. * * @param row the row to be edited * @param column the column to be edited * @return false if for any reason the cell cannot be edited, * or if the indices are invalid
*** 3497,3519 **** public boolean editCellAt(int row, int column) { return editCellAt(row, column, null); } /** ! * Programmatically starts editing the cell at <code>row</code> and ! * <code>column</code>, if those indices are in the valid range, and * the cell at those indices is editable. ! * To prevent the <code>JTable</code> from * editing a particular table, column or cell value, return false from ! * the <code>isCellEditable</code> method in the <code>TableModel</code> * interface. * * @param row the row to be edited * @param column the column to be edited ! * @param e event to pass into <code>shouldSelectCell</code>; * note that as of Java 2 platform v1.2, the call to ! * <code>shouldSelectCell</code> is no longer made * @return false if for any reason the cell cannot be edited, * or if the indices are invalid */ public boolean editCellAt(int row, int column, EventObject e){ if (cellEditor != null && !cellEditor.stopCellEditing()) { --- 3497,3519 ---- public boolean editCellAt(int row, int column) { return editCellAt(row, column, null); } /** ! * Programmatically starts editing the cell at {@code row} and ! * {@code column}, if those indices are in the valid range, and * the cell at those indices is editable. ! * To prevent the {@code JTable} from * editing a particular table, column or cell value, return false from ! * the {@code isCellEditable} method in the {@code TableModel} * interface. * * @param row the row to be edited * @param column the column to be edited ! * @param e event to pass into {@code shouldSelectCell}; * note that as of Java 2 platform v1.2, the call to ! * {@code shouldSelectCell} is no longer made * @return false if for any reason the cell cannot be edited, * or if the indices are invalid */ public boolean editCellAt(int row, int column, EventObject e){ if (cellEditor != null && !cellEditor.stopCellEditing()) {
*** 3607,3617 **** // /** * Returns the L&amp;F object that renders this component. * ! * @return the <code>TableUI</code> object that renders this component */ public TableUI getUI() { return (TableUI)ui; } --- 3607,3617 ---- // /** * Returns the L&amp;F object that renders this component. * ! * @return the {@code TableUI} object that renders this component */ public TableUI getUI() { return (TableUI)ui; }
*** 3632,3644 **** repaint(); } } /** ! * Notification from the <code>UIManager</code> that the L&amp;F has changed. * Replaces the current UI object with the latest version from the ! * <code>UIManager</code>. * * @see JComponent#updateUI */ public void updateUI() { // Update the UIs of the cell renderers, cell editors and header renderers. --- 3632,3644 ---- repaint(); } } /** ! * Notification from the {@code UIManager} that the L&amp;F has changed. * Replaces the current UI object with the latest version from the ! * {@code UIManager}. * * @see JComponent#updateUI */ public void updateUI() { // Update the UIs of the cell renderers, cell editors and header renderers.
*** 3827,3841 **** // // RowSorterListener // /** ! * <code>RowSorterListener</code> notification that the ! * <code>RowSorter</code> has changed in some way. * ! * @param e the <code>RowSorterEvent</code> describing the change ! * @throws NullPointerException if <code>e</code> is <code>null</code> * @since 1.6 */ public void sorterChanged(RowSorterEvent e) { if (e.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) { JTableHeader header = getTableHeader(); --- 3827,3841 ---- // // RowSorterListener // /** ! * {@code RowSorterListener} notification that the ! * {@code RowSorter} has changed in some way. * ! * @param e the {@code RowSorterEvent} describing the change ! * @throws NullPointerException if {@code e} is {@code null} * @since 1.6 */ public void sorterChanged(RowSorterEvent e) { if (e.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) { JTableHeader header = getTableHeader();
*** 4123,4134 **** allRowsChanged = (e.getLastRow() == Integer.MAX_VALUE); } } /** ! * Invoked when <code>sorterChanged</code> is invoked, or ! * when <code>tableChanged</code> is invoked and sorting is enabled. */ private void sortedTableChanged(RowSorterEvent sortedEvent, TableModelEvent e) { int editingModelIndex = -1; ModelChange change = (e != null) ? new ModelChange(e) : null; --- 4123,4134 ---- allRowsChanged = (e.getLastRow() == Integer.MAX_VALUE); } } /** ! * Invoked when {@code sorterChanged} is invoked, or ! * when {@code tableChanged} is invoked and sorting is enabled. */ private void sortedTableChanged(RowSorterEvent sortedEvent, TableModelEvent e) { int editingModelIndex = -1; ModelChange change = (e != null) ? new ModelChange(e) : null;
*** 4380,4398 **** // // Implementing TableModelListener interface // /** ! * Invoked when this table's <code>TableModel</code> generates ! * a <code>TableModelEvent</code>. ! * The <code>TableModelEvent</code> should be constructed in the * coordinate system of the model; the appropriate mapping to the ! * view coordinate system is performed by this <code>JTable</code> * when it receives the event. * <p> * Application code will not use these methods explicitly, they ! * are used internally by <code>JTable</code>. * <p> * Note that as of 1.3, this method clears the selection, if any. */ public void tableChanged(TableModelEvent e) { if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) { --- 4380,4398 ---- // // Implementing TableModelListener interface // /** ! * Invoked when this table's {@code TableModel} generates ! * a {@code TableModelEvent}. ! * The {@code TableModelEvent} should be constructed in the * coordinate system of the model; the appropriate mapping to the ! * view coordinate system is performed by this {@code JTable} * when it receives the event. * <p> * Application code will not use these methods explicitly, they ! * are used internally by {@code JTable}. * <p> * Note that as of 1.3, this method clears the selection, if any. */ public void tableChanged(TableModelEvent e) { if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) {
*** 4639,4649 **** private int limit(int i, int a, int b) { return Math.min(b, Math.max(i, a)); } /** ! * Invoked when the selection model of the <code>TableColumnModel</code> * is changed. * <p> * Application code will not use these methods explicitly, they * are used internally by JTable. * --- 4639,4649 ---- private int limit(int i, int a, int b) { return Math.min(b, Math.max(i, a)); } /** ! * Invoked when the selection model of the {@code TableColumnModel} * is changed. * <p> * Application code will not use these methods explicitly, they * are used internally by JTable. *
*** 4779,4790 **** // /** * 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) { --- 4779,4790 ---- // /** * Sets the preferred size of the viewport for this table. * ! * @param size a {@code Dimension} object specifying the {@code preferredSize} of a ! * {@code JViewport} whose view is this table * @see Scrollable#getPreferredScrollableViewportSize * @beaninfo * description: The preferred size of the viewport. */ public void setPreferredScrollableViewportSize(Dimension size) {
*** 4792,4802 **** } /** * Returns the preferred size of the viewport for this table. * ! * @return a <code>Dimension</code> object containing the <code>preferredSize</code> of the <code>JViewport</code> * which displays this table * @see Scrollable#getPreferredScrollableViewportSize */ public Dimension getPreferredScrollableViewportSize() { return preferredViewportSize; --- 4792,4802 ---- } /** * Returns the preferred size of the viewport for this table. * ! * @return a {@code Dimension} object containing the {@code preferredSize} of the {@code JViewport} * which displays this table * @see Scrollable#getPreferredScrollableViewportSize */ public Dimension getPreferredScrollableViewportSize() { return preferredViewportSize;
*** 4807,4818 **** * row or column (depending on the orientation). * <p> * This method is called each time the user requests a unit scroll. * * @param visibleRect the view area visible within the viewport ! * @param orientation either <code>SwingConstants.VERTICAL</code> ! * or <code>SwingConstants.HORIZONTAL</code> * @param direction less than zero to scroll up/left, * greater than zero for down/right * @return the "unit" increment for scrolling in the specified direction * @see Scrollable#getScrollableUnitIncrement */ --- 4807,4818 ---- * row or column (depending on the orientation). * <p> * This method is called each time the user requests a unit scroll. * * @param visibleRect the view area visible within the viewport ! * @param orientation either {@code SwingConstants.VERTICAL} ! * or {@code SwingConstants.HORIZONTAL} * @param direction less than zero to scroll up/left, * greater than zero for down/right * @return the "unit" increment for scrolling in the specified direction * @see Scrollable#getScrollableUnitIncrement */
*** 4903,4921 **** } } } /** ! * Returns <code>visibleRect.height</code> or ! * <code>visibleRect.width</code>, * depending on this table's orientation. Note that as of Swing 1.1.1 * (Java 2 v 1.2.2) the value * returned will ensure that the viewport is cleanly aligned on * a row boundary. * ! * @return <code>visibleRect.height</code> or ! * <code>visibleRect.width</code> * per the orientation * @see Scrollable#getScrollableBlockIncrement */ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { --- 4903,4921 ---- } } } /** ! * Returns {@code visibleRect.height} or ! * {@code visibleRect.width}, * depending on this table's orientation. Note that as of Swing 1.1.1 * (Java 2 v 1.2.2) the value * returned will ensure that the viewport is cleanly aligned on * a row boundary. * ! * @return {@code visibleRect.height} or ! * {@code visibleRect.width} * per the orientation * @see Scrollable#getScrollableBlockIncrement */ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
*** 5211,5227 **** return rect.x; } } /** ! * Returns false if <code>autoResizeMode</code> is set to ! * <code>AUTO_RESIZE_OFF</code>, which indicates that the * width of the viewport does not determine the width * of the table. Otherwise returns true. * ! * @return false if <code>autoResizeMode</code> is set ! * to <code>AUTO_RESIZE_OFF</code>, otherwise returns true * @see Scrollable#getScrollableTracksViewportWidth */ public boolean getScrollableTracksViewportWidth() { return !(autoResizeMode == AUTO_RESIZE_OFF); } --- 5211,5227 ---- return rect.x; } } /** ! * Returns false if {@code autoResizeMode} is set to ! * {@code AUTO_RESIZE_OFF}, which indicates that the * width of the viewport does not determine the width * of the table. Otherwise returns true. * ! * @return false if {@code autoResizeMode} is set ! * to {@code AUTO_RESIZE_OFF}, otherwise returns true * @see Scrollable#getScrollableTracksViewportWidth */ public boolean getScrollableTracksViewportWidth() { return !(autoResizeMode == AUTO_RESIZE_OFF); }
*** 5587,5597 **** setAutoscrolls(true); } /** * Returns the default table model object, which is ! * a <code>DefaultTableModel</code>. A subclass can override this * method to return a different table model object. * * @return the default table model object * @see javax.swing.table.DefaultTableModel */ --- 5587,5597 ---- setAutoscrolls(true); } /** * Returns the default table model object, which is ! * a {@code DefaultTableModel}. A subclass can override this * method to return a different table model object. * * @return the default table model object * @see javax.swing.table.DefaultTableModel */
*** 5599,5609 **** return new DefaultTableModel(); } /** * Returns the default column model object, which is ! * a <code>DefaultTableColumnModel</code>. A subclass can override this * method to return a different column model object. * * @return the default column model object * @see javax.swing.table.DefaultTableColumnModel */ --- 5599,5609 ---- return new DefaultTableModel(); } /** * Returns the default column model object, which is ! * a {@code DefaultTableColumnModel}. A subclass can override this * method to return a different column model object. * * @return the default column model object * @see javax.swing.table.DefaultTableColumnModel */
*** 5611,5621 **** return new DefaultTableColumnModel(); } /** * Returns the default selection model object, which is ! * a <code>DefaultListSelectionModel</code>. A subclass can override this * method to return a different selection model object. * * @return the default selection model object * @see javax.swing.DefaultListSelectionModel */ --- 5611,5621 ---- return new DefaultTableColumnModel(); } /** * Returns the default selection model object, which is ! * a {@code DefaultListSelectionModel}. A subclass can override this * method to return a different selection model object. * * @return the default selection model object * @see javax.swing.DefaultListSelectionModel */
*** 5623,5644 **** return new DefaultListSelectionModel(); } /** * Returns the default table header object, which is ! * a <code>JTableHeader</code>. A subclass can override this * method to return a different table header object. * * @return the default table header object * @see javax.swing.table.JTableHeader */ protected JTableHeader createDefaultTableHeader() { return new JTableHeader(columnModel); } /** ! * Equivalent to <code>revalidate</code> followed by <code>repaint</code>. */ protected void resizeAndRepaint() { revalidate(); repaint(); } --- 5623,5644 ---- return new DefaultListSelectionModel(); } /** * Returns the default table header object, which is ! * a {@code JTableHeader}. A subclass can override this * method to return a different table header object. * * @return the default table header object * @see javax.swing.table.JTableHeader */ protected JTableHeader createDefaultTableHeader() { return new JTableHeader(columnModel); } /** ! * Equivalent to {@code revalidate} followed by {@code repaint}. */ protected void resizeAndRepaint() { revalidate(); repaint(); }
*** 5670,5714 **** cellEditor = anEditor; firePropertyChange("tableCellEditor", oldEditor, anEditor); } /** ! * Sets the <code>editingColumn</code> variable. * @param aColumn the column of the cell to be edited * * @see #editingColumn */ public void setEditingColumn(int aColumn) { editingColumn = aColumn; } /** ! * Sets the <code>editingRow</code> variable. * @param aRow the row of the cell to be edited * * @see #editingRow */ public void setEditingRow(int aRow) { editingRow = aRow; } /** * Returns an appropriate renderer for the cell specified by this row and ! * column. If the <code>TableColumn</code> for this column has a non-null * renderer, returns that. If not, finds the class of the data in ! * this column (using <code>getColumnClass</code>) * and returns the default renderer for this type of data. * <p> * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to provide renderers so that this default behavior * can be safely overridden by a subclass. * * @param row the row of the cell to render, where 0 is the first row * @param column the column of the cell to render, * where 0 is the first column ! * @return the assigned renderer; if <code>null</code> * returns the default renderer * for this type of object * @see javax.swing.table.DefaultTableCellRenderer * @see javax.swing.table.TableColumn#setCellRenderer * @see #setDefaultRenderer --- 5670,5714 ---- cellEditor = anEditor; firePropertyChange("tableCellEditor", oldEditor, anEditor); } /** ! * Sets the {@code editingColumn} variable. * @param aColumn the column of the cell to be edited * * @see #editingColumn */ public void setEditingColumn(int aColumn) { editingColumn = aColumn; } /** ! * Sets the {@code editingRow} variable. * @param aRow the row of the cell to be edited * * @see #editingRow */ public void setEditingRow(int aRow) { editingRow = aRow; } /** * Returns an appropriate renderer for the cell specified by this row and ! * column. If the {@code TableColumn} for this column has a non-null * renderer, returns that. If not, finds the class of the data in ! * this column (using {@code getColumnClass}) * and returns the default renderer for this type of data. * <p> * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to provide renderers so that this default behavior * can be safely overridden by a subclass. * * @param row the row of the cell to render, where 0 is the first row * @param column the column of the cell to render, * where 0 is the first column ! * @return the assigned renderer; if {@code null} * returns the default renderer * for this type of object * @see javax.swing.table.DefaultTableCellRenderer * @see javax.swing.table.TableColumn#setCellRenderer * @see #setDefaultRenderer
*** 5723,5735 **** } /** * Prepares the renderer by querying the data model for the * value and selection state ! * of the cell at <code>row</code>, <code>column</code>. ! * Returns the component (may be a <code>Component</code> ! * or a <code>JComponent</code>) under the event location. * <p> * During a printing operation, this method will configure the * renderer without indicating selection or focus, to prevent * them from appearing in the printed output. To do other * customizations based on whether or not the table is being --- 5723,5735 ---- } /** * Prepares the renderer by querying the data model for the * value and selection state ! * of the cell at {@code row}, {@code column}. ! * Returns the component (may be a {@code Component} ! * or a {@code JComponent}) under the event location. * <p> * During a printing operation, this method will configure the * renderer without indicating selection or focus, to prevent * them from appearing in the printed output. To do other * customizations based on whether or not the table is being
*** 5740,5754 **** * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to prepare renderers so that this default behavior * can be safely overridden by a subclass. * ! * @param renderer the <code>TableCellRenderer</code> to prepare * @param row the row of the cell to render, where 0 is the first row * @param column the column of the cell to render, * where 0 is the first column ! * @return the <code>Component</code> under the event location */ public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Object value = getValueAt(row, column); boolean isSelected = false; --- 5740,5754 ---- * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to prepare renderers so that this default behavior * can be safely overridden by a subclass. * ! * @param renderer the {@code TableCellRenderer} to prepare * @param row the row of the cell to render, where 0 is the first row * @param column the column of the cell to render, * where 0 is the first column ! * @return the {@code Component} under the event location */ public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Object value = getValueAt(row, column); boolean isSelected = false;
*** 5771,5784 **** row, column); } /** * Returns an appropriate editor for the cell specified by ! * <code>row</code> and <code>column</code>. If the ! * <code>TableColumn</code> for this column has a non-null editor, * returns that. If not, finds the class of the data in this ! * column (using <code>getColumnClass</code>) * and returns the default editor for this type of data. * <p> * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to provide editors so that this default behavior --- 5771,5784 ---- row, column); } /** * Returns an appropriate editor for the cell specified by ! * {@code row} and {@code column}. If the ! * {@code TableColumn} for this column has a non-null editor, * returns that. If not, finds the class of the data in this ! * column (using {@code getColumnClass}) * and returns the default editor for this type of data. * <p> * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to provide editors so that this default behavior
*** 5786,5796 **** * * @param row the row of the cell to edit, where 0 is the first row * @param column the column of the cell to edit, * where 0 is the first column * @return the editor for this cell; ! * if <code>null</code> return the default editor for * this type of cell * @see DefaultCellEditor */ public TableCellEditor getCellEditor(int row, int column) { TableColumn tableColumn = getColumnModel().getColumn(column); --- 5786,5796 ---- * * @param row the row of the cell to edit, where 0 is the first row * @param column the column of the cell to edit, * where 0 is the first column * @return the editor for this cell; ! * if {@code null} return the default editor for * this type of cell * @see DefaultCellEditor */ public TableCellEditor getCellEditor(int row, int column) { TableColumn tableColumn = getColumnModel().getColumn(column);
*** 5802,5824 **** } /** * Prepares the editor by querying the data model for the value and ! * selection state of the cell at <code>row</code>, <code>column</code>. * <p> * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to prepare editors so that this default behavior * can be safely overridden by a subclass. * ! * @param editor the <code>TableCellEditor</code> to set up * @param row the row of the cell to edit, * where 0 is the first row * @param column the column of the cell to edit, * where 0 is the first column ! * @return the <code>Component</code> being edited */ @SuppressWarnings("deprecation") public Component prepareEditor(TableCellEditor editor, int row, int column) { Object value = getValueAt(row, column); boolean isSelected = isCellSelected(row, column); --- 5802,5824 ---- } /** * Prepares the editor by querying the data model for the value and ! * selection state of the cell at {@code row}, {@code column}. * <p> * <b>Note:</b> * Throughout the table package, the internal implementations always * use this method to prepare editors so that this default behavior * can be safely overridden by a subclass. * ! * @param editor the {@code TableCellEditor} to set up * @param row the row of the cell to edit, * where 0 is the first row * @param column the column of the cell to edit, * where 0 is the first column ! * @return the {@code Component} being edited */ @SuppressWarnings("deprecation") public Component prepareEditor(TableCellEditor editor, int row, int column) { Object value = getValueAt(row, column); boolean isSelected = isCellSelected(row, column);
*** 5987,5997 **** /** * Returns a string representation of this table. 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 ! * be <code>null</code>. * * @return a string representation of this table */ protected String paramString() { String gridColorString = (gridColor != null ? --- 5987,5997 ---- /** * Returns a string representation of this table. 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 ! * be {@code null}. * * @return a string representation of this table */ protected String paramString() { String gridColorString = (gridColor != null ?
*** 6084,6094 **** // Printing Support ///////////////// /** * A convenience method that displays a printing dialog, and then prints ! * this <code>JTable</code> in mode <code>PrintMode.FIT_WIDTH</code>, * with no header or footer text. A modal progress dialog, with an abort * option, will be shown for the duration of printing. * <p> * Note: In headless mode, no dialogs are shown and printing * occurs on the default printer. --- 6084,6094 ---- // Printing Support ///////////////// /** * A convenience method that displays a printing dialog, and then prints ! * this {@code JTable} in mode {@code PrintMode.FIT_WIDTH}, * with no header or footer text. A modal progress dialog, with an abort * option, will be shown for the duration of printing. * <p> * Note: In headless mode, no dialogs are shown and printing * occurs on the default printer.
*** 6109,6119 **** return print(PrintMode.FIT_WIDTH); } /** * A convenience method that displays a printing dialog, and then prints ! * this <code>JTable</code> in the given printing mode, * with no header or footer text. A modal progress dialog, with an abort * option, will be shown for the duration of printing. * <p> * Note: In headless mode, no dialogs are shown and printing * occurs on the default printer. --- 6109,6119 ---- return print(PrintMode.FIT_WIDTH); } /** * A convenience method that displays a printing dialog, and then prints ! * this {@code JTable} in the given printing mode, * with no header or footer text. A modal progress dialog, with an abort * option, will be shown for the duration of printing. * <p> * Note: In headless mode, no dialogs are shown and printing * occurs on the default printer.
*** 6135,6156 **** return print(printMode, null, null); } /** * A convenience method that displays a printing dialog, and then prints ! * this <code>JTable</code> in the given printing mode, * with the specified header and footer text. A modal progress dialog, * with an abort option, will be shown for the duration of printing. * <p> * Note: In headless mode, no dialogs are shown and printing * occurs on the default printer. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a <code>MessageFormat</code> specifying the text * to be used in printing a header, * or null for none ! * @param footerFormat a <code>MessageFormat</code> specifying the text * to be used in printing a footer, * or null for none * @return true, unless printing is cancelled by the user * @throws SecurityException if this thread is not allowed to * initiate a print job request --- 6135,6156 ---- return print(printMode, null, null); } /** * A convenience method that displays a printing dialog, and then prints ! * this {@code JTable} in the given printing mode, * with the specified header and footer text. A modal progress dialog, * with an abort option, will be shown for the duration of printing. * <p> * Note: In headless mode, no dialogs are shown and printing * occurs on the default printer. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a {@code MessageFormat} specifying the text * to be used in printing a header, * or null for none ! * @param footerFormat a {@code MessageFormat} specifying the text * to be used in printing a footer, * or null for none * @return true, unless printing is cancelled by the user * @throws SecurityException if this thread is not allowed to * initiate a print job request
*** 6176,6201 **** * {@link #print(JTable.PrintMode, MessageFormat, MessageFormat, * boolean, PrintRequestAttributeSet, boolean, PrintService) print} * method, with the default printer specified as the print service. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a <code>MessageFormat</code> specifying the text * to be used in printing a header, ! * or <code>null</code> for none ! * @param footerFormat a <code>MessageFormat</code> specifying the text * to be used in printing a footer, ! * or <code>null</code> for none * @param showPrintDialog whether or not to display a print dialog ! * @param attr a <code>PrintRequestAttributeSet</code> * specifying any printing attributes, ! * or <code>null</code> for none * @param interactive whether or not to print in an interactive mode * @return true, unless printing is cancelled by the user * @throws HeadlessException if the method is asked to show a printing * dialog or run interactively, and ! * <code>GraphicsEnvironment.isHeadless</code> ! * returns <code>true</code> * @throws SecurityException if this thread is not allowed to * initiate a print job request * @throws PrinterException if an error in the print system causes the job * to be aborted * @see #print(JTable.PrintMode, MessageFormat, MessageFormat, --- 6176,6201 ---- * {@link #print(JTable.PrintMode, MessageFormat, MessageFormat, * boolean, PrintRequestAttributeSet, boolean, PrintService) print} * method, with the default printer specified as the print service. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a {@code MessageFormat} specifying the text * to be used in printing a header, ! * or {@code null} for none ! * @param footerFormat a {@code MessageFormat} specifying the text * to be used in printing a footer, ! * or {@code null} for none * @param showPrintDialog whether or not to display a print dialog ! * @param attr a {@code PrintRequestAttributeSet} * specifying any printing attributes, ! * or {@code null} for none * @param interactive whether or not to print in an interactive mode * @return true, unless printing is cancelled by the user * @throws HeadlessException if the method is asked to show a printing * dialog or run interactively, and ! * {@code GraphicsEnvironment.isHeadless} ! * returns {@code true} * @throws SecurityException if this thread is not allowed to * initiate a print job request * @throws PrinterException if an error in the print system causes the job * to be aborted * @see #print(JTable.PrintMode, MessageFormat, MessageFormat,
*** 6220,6296 **** interactive, null); } /** ! * Prints this <code>JTable</code>. Takes steps that the majority of ! * developers would take in order to print a <code>JTable</code>. ! * In short, it prepares the table, calls <code>getPrintable</code> to ! * fetch an appropriate <code>Printable</code>, and then sends it to the * printer. * <p> ! * A <code>boolean</code> parameter allows you to specify whether or not * a printing dialog is displayed to the user. When it is, the user may * use the dialog to change the destination printer or printing attributes, * or even to cancel the print. Another two parameters allow for a ! * <code>PrintService</code> and printing attributes to be specified. * These parameters can be used either to provide initial values for the * print dialog, or to specify values when the dialog is not shown. * <p> ! * A second <code>boolean</code> parameter allows you to specify whether ! * or not to perform printing in an interactive mode. If <code>true</code>, * a modal progress dialog, with an abort option, is displayed for the * duration of printing . This dialog also prevents any user action which * may affect the table. However, it can not prevent the table from being * modified by code (for example, another thread that posts updates using ! * <code>SwingUtilities.invokeLater</code>). It is therefore the * responsibility of the developer to ensure that no other code modifies * the table in any way during printing (invalid modifications include * changes in: size, renderers, or underlying data). Printing behavior is * undefined when the table is changed during printing. * <p> ! * If <code>false</code> is specified for this parameter, no dialog will * be displayed and printing will begin immediately on the event-dispatch * thread. This blocks any other events, including repaints, from being * processed until printing is complete. Although this effectively prevents * the table from being changed, it doesn't provide a good user experience. ! * For this reason, specifying <code>false</code> is only recommended when * printing from an application with no visible GUI. * <p> * Note: Attempting to show the printing dialog or run interactively, while ! * in headless mode, will result in a <code>HeadlessException</code>. * <p> * Before fetching the printable, this method will gracefully terminate * editing, if necessary, to prevent an editor from showing in the printed ! * result. Additionally, <code>JTable</code> will prepare its renderers * during printing such that selection and focus are not indicated. * As far as customizing further how the table looks in the printout, * developers can provide custom renderers or paint code that conditionalize * on the value of {@link javax.swing.JComponent#isPaintingForPrint()}. * <p> * See {@link #getPrintable} for more description on how the table is * printed. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a <code>MessageFormat</code> specifying the text * to be used in printing a header, ! * or <code>null</code> for none ! * @param footerFormat a <code>MessageFormat</code> specifying the text * to be used in printing a footer, ! * or <code>null</code> for none * @param showPrintDialog whether or not to display a print dialog ! * @param attr a <code>PrintRequestAttributeSet</code> * specifying any printing attributes, ! * or <code>null</code> for none * @param interactive whether or not to print in an interactive mode ! * @param service the destination <code>PrintService</code>, ! * or <code>null</code> to use the default printer * @return true, unless printing is cancelled by the user * @throws HeadlessException if the method is asked to show a printing * dialog or run interactively, and ! * <code>GraphicsEnvironment.isHeadless</code> ! * returns <code>true</code> * @throws SecurityException if a security manager exists and its * {@link java.lang.SecurityManager#checkPrintJobAccess} * method disallows this thread from creating a print job request * @throws PrinterException if an error in the print system causes the job * to be aborted --- 6220,6296 ---- interactive, null); } /** ! * Prints this {@code JTable}. Takes steps that the majority of ! * developers would take in order to print a {@code JTable}. ! * In short, it prepares the table, calls {@code getPrintable} to ! * fetch an appropriate {@code Printable}, and then sends it to the * printer. * <p> ! * A {@code boolean} parameter allows you to specify whether or not * a printing dialog is displayed to the user. When it is, the user may * use the dialog to change the destination printer or printing attributes, * or even to cancel the print. Another two parameters allow for a ! * {@code PrintService} and printing attributes to be specified. * These parameters can be used either to provide initial values for the * print dialog, or to specify values when the dialog is not shown. * <p> ! * A second {@code boolean} parameter allows you to specify whether ! * or not to perform printing in an interactive mode. If {@code true}, * a modal progress dialog, with an abort option, is displayed for the * duration of printing . This dialog also prevents any user action which * may affect the table. However, it can not prevent the table from being * modified by code (for example, another thread that posts updates using ! * {@code SwingUtilities.invokeLater}). It is therefore the * responsibility of the developer to ensure that no other code modifies * the table in any way during printing (invalid modifications include * changes in: size, renderers, or underlying data). Printing behavior is * undefined when the table is changed during printing. * <p> ! * If {@code false} is specified for this parameter, no dialog will * be displayed and printing will begin immediately on the event-dispatch * thread. This blocks any other events, including repaints, from being * processed until printing is complete. Although this effectively prevents * the table from being changed, it doesn't provide a good user experience. ! * For this reason, specifying {@code false} is only recommended when * printing from an application with no visible GUI. * <p> * Note: Attempting to show the printing dialog or run interactively, while ! * in headless mode, will result in a {@code HeadlessException}. * <p> * Before fetching the printable, this method will gracefully terminate * editing, if necessary, to prevent an editor from showing in the printed ! * result. Additionally, {@code JTable} will prepare its renderers * during printing such that selection and focus are not indicated. * As far as customizing further how the table looks in the printout, * developers can provide custom renderers or paint code that conditionalize * on the value of {@link javax.swing.JComponent#isPaintingForPrint()}. * <p> * See {@link #getPrintable} for more description on how the table is * printed. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a {@code MessageFormat} specifying the text * to be used in printing a header, ! * or {@code null} for none ! * @param footerFormat a {@code MessageFormat} specifying the text * to be used in printing a footer, ! * or {@code null} for none * @param showPrintDialog whether or not to display a print dialog ! * @param attr a {@code PrintRequestAttributeSet} * specifying any printing attributes, ! * or {@code null} for none * @param interactive whether or not to print in an interactive mode ! * @param service the destination {@code PrintService}, ! * or {@code null} to use the default printer * @return true, unless printing is cancelled by the user * @throws HeadlessException if the method is asked to show a printing * dialog or run interactively, and ! * {@code GraphicsEnvironment.isHeadless} ! * returns {@code true} * @throws SecurityException if a security manager exists and its * {@link java.lang.SecurityManager#checkPrintJobAccess} * method disallows this thread from creating a print job request * @throws PrinterException if an error in the print system causes the job * to be aborted
*** 6434,6536 **** return true; } /** ! * Return a <code>Printable</code> for use in printing this JTable. * <p> * This method is meant for those wishing to customize the default ! * <code>Printable</code> implementation used by <code>JTable</code>'s ! * <code>print</code> methods. Developers wanting simply to print the table * should use one of those methods directly. * <p> ! * The <code>Printable</code> can be requested in one of two printing modes. * In both modes, it spreads table rows naturally in sequence across * multiple pages, fitting as many rows as possible per page. ! * <code>PrintMode.NORMAL</code> specifies that the table be * printed at its current size. In this mode, there may be a need to spread * columns across pages in a similar manner to that of the rows. When the * need arises, columns are distributed in an order consistent with the ! * table's <code>ComponentOrientation</code>. ! * <code>PrintMode.FIT_WIDTH</code> specifies that the output be * scaled smaller, if necessary, to fit the table's entire width * (and thereby all columns) on each page. Width and height are scaled * equally, maintaining the aspect ratio of the output. * <p> ! * The <code>Printable</code> heads the portion of table on each page ! * with the appropriate section from the table's <code>JTableHeader</code>, * if it has one. * <p> * Header and footer text can be added to the output by providing ! * <code>MessageFormat</code> arguments. The printing code requests * Strings from the formats, providing a single item which may be included ! * in the formatted string: an <code>Integer</code> representing the current * page number. * <p> * You are encouraged to read the documentation for ! * <code>MessageFormat</code> as some characters, such as single-quote, * are special and need to be escaped. * <p> ! * Here's an example of creating a <code>MessageFormat</code> that can be * used to print "Duke's Table: Page - " and the current page number: * * <pre> * // notice the escaping of the single quote * // notice how the page number is included with "{0}" * MessageFormat format = new MessageFormat("Duke''s Table: Page - {0}"); * </pre> * <p> ! * The <code>Printable</code> constrains what it draws to the printable * area of each page that it prints. Under certain circumstances, it may * find it impossible to fit all of a page's content into that area. In * these cases the output may be clipped, but the implementation * makes an effort to do something reasonable. Here are a few situations * where this is known to occur, and how they may be handled by this * particular implementation: * <ul> * <li>In any mode, when the header or footer text is too wide to fit * completely in the printable area -- print as much of the text as * possible starting from the beginning, as determined by the table's ! * <code>ComponentOrientation</code>. * <li>In any mode, when a row is too tall to fit in the * printable area -- print the upper-most portion of the row * and paint no lower border on the table. ! * <li>In <code>PrintMode.NORMAL</code> when a column * is too wide to fit in the printable area -- print the center * portion of the column and leave the left and right borders * off the table. * </ul> * <p> ! * It is entirely valid for this <code>Printable</code> to be wrapped * inside another in order to create complex reports and documents. You may * even request that different pages be rendered into different sized * printable areas. The implementation must be prepared to handle this * (possibly by doing its layout calculations on the fly). However, * providing different heights to each page will likely not work well ! * with <code>PrintMode.NORMAL</code> when it has to spread columns * across pages. * <p> * As far as customizing how the table looks in the printed result, ! * <code>JTable</code> itself will take care of hiding the selection * and focus during printing. For additional customizations, your * renderers or painting code can customize the look based on the value * of {@link javax.swing.JComponent#isPaintingForPrint()} * <p> * Also, <i>before</i> calling this method you may wish to <i>first</i> * modify the state of the table, such as to cancel cell editing or * have the user size the table appropriately. However, you must not ! * modify the state of the table <i>after</i> this <code>Printable</code> * has been fetched (invalid modifications include changes in size or ! * underlying data). The behavior of the returned <code>Printable</code> * is undefined once the table has been changed. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a <code>MessageFormat</code> specifying the text to * be used in printing a header, or null for none ! * @param footerFormat a <code>MessageFormat</code> specifying the text to * be used in printing a footer, or null for none ! * @return a <code>Printable</code> for printing this JTable * @see #print(JTable.PrintMode, MessageFormat, MessageFormat, * boolean, PrintRequestAttributeSet, boolean) * @see Printable * @see PrinterJob * --- 6434,6536 ---- return true; } /** ! * Return a {@code Printable} for use in printing this JTable. * <p> * This method is meant for those wishing to customize the default ! * {@code Printable} implementation used by {@code JTable}'s ! * {@code print} methods. Developers wanting simply to print the table * should use one of those methods directly. * <p> ! * The {@code Printable} can be requested in one of two printing modes. * In both modes, it spreads table rows naturally in sequence across * multiple pages, fitting as many rows as possible per page. ! * {@code PrintMode.NORMAL} specifies that the table be * printed at its current size. In this mode, there may be a need to spread * columns across pages in a similar manner to that of the rows. When the * need arises, columns are distributed in an order consistent with the ! * table's {@code ComponentOrientation}. ! * {@code PrintMode.FIT_WIDTH} specifies that the output be * scaled smaller, if necessary, to fit the table's entire width * (and thereby all columns) on each page. Width and height are scaled * equally, maintaining the aspect ratio of the output. * <p> ! * The {@code Printable} heads the portion of table on each page ! * with the appropriate section from the table's {@code JTableHeader}, * if it has one. * <p> * Header and footer text can be added to the output by providing ! * {@code MessageFormat} arguments. The printing code requests * Strings from the formats, providing a single item which may be included ! * in the formatted string: an {@code Integer} representing the current * page number. * <p> * You are encouraged to read the documentation for ! * {@code MessageFormat} as some characters, such as single-quote, * are special and need to be escaped. * <p> ! * Here's an example of creating a {@code MessageFormat} that can be * used to print "Duke's Table: Page - " and the current page number: * * <pre> * // notice the escaping of the single quote * // notice how the page number is included with "{0}" * MessageFormat format = new MessageFormat("Duke''s Table: Page - {0}"); * </pre> * <p> ! * The {@code Printable} constrains what it draws to the printable * area of each page that it prints. Under certain circumstances, it may * find it impossible to fit all of a page's content into that area. In * these cases the output may be clipped, but the implementation * makes an effort to do something reasonable. Here are a few situations * where this is known to occur, and how they may be handled by this * particular implementation: * <ul> * <li>In any mode, when the header or footer text is too wide to fit * completely in the printable area -- print as much of the text as * possible starting from the beginning, as determined by the table's ! * {@code ComponentOrientation}. * <li>In any mode, when a row is too tall to fit in the * printable area -- print the upper-most portion of the row * and paint no lower border on the table. ! * <li>In {@code PrintMode.NORMAL} when a column * is too wide to fit in the printable area -- print the center * portion of the column and leave the left and right borders * off the table. * </ul> * <p> ! * It is entirely valid for this {@code Printable} to be wrapped * inside another in order to create complex reports and documents. You may * even request that different pages be rendered into different sized * printable areas. The implementation must be prepared to handle this * (possibly by doing its layout calculations on the fly). However, * providing different heights to each page will likely not work well ! * with {@code PrintMode.NORMAL} when it has to spread columns * across pages. * <p> * As far as customizing how the table looks in the printed result, ! * {@code JTable} itself will take care of hiding the selection * and focus during printing. For additional customizations, your * renderers or painting code can customize the look based on the value * of {@link javax.swing.JComponent#isPaintingForPrint()} * <p> * Also, <i>before</i> calling this method you may wish to <i>first</i> * modify the state of the table, such as to cancel cell editing or * have the user size the table appropriately. However, you must not ! * modify the state of the table <i>after</i> this {@code Printable} * has been fetched (invalid modifications include changes in size or ! * underlying data). The behavior of the returned {@code Printable} * is undefined once the table has been changed. * * @param printMode the printing mode that the printable should use ! * @param headerFormat a {@code MessageFormat} specifying the text to * be used in printing a header, or null for none ! * @param footerFormat a {@code MessageFormat} specifying the text to * be used in printing a footer, or null for none ! * @return a {@code Printable} for printing this JTable * @see #print(JTable.PrintMode, MessageFormat, MessageFormat, * boolean, PrintRequestAttributeSet, boolean) * @see Printable * @see PrinterJob *
*** 6543,6575 **** return new TablePrintable(this, printMode, headerFormat, footerFormat); } /** ! * A <code>Printable</code> implementation that wraps another ! * <code>Printable</code>, making it safe for printing on another thread. */ private class ThreadSafePrintable implements Printable { ! /** The delegate <code>Printable</code>. */ private Printable printDelegate; /** * To communicate any return value when delegating. */ private int retVal; /** ! * To communicate any <code>Throwable</code> when delegating. */ private Throwable retThrowable; /** ! * Construct a <code>ThreadSafePrintable</code> around the given * delegate. * ! * @param printDelegate the <code>Printable</code> to delegate to */ public ThreadSafePrintable(Printable printDelegate) { this.printDelegate = printDelegate; } --- 6543,6575 ---- return new TablePrintable(this, printMode, headerFormat, footerFormat); } /** ! * A {@code Printable} implementation that wraps another ! * {@code Printable}, making it safe for printing on another thread. */ private class ThreadSafePrintable implements Printable { ! /** The delegate {@code Printable}. */ private Printable printDelegate; /** * To communicate any return value when delegating. */ private int retVal; /** ! * To communicate any {@code Throwable} when delegating. */ private Throwable retThrowable; /** ! * Construct a {@code ThreadSafePrintable} around the given * delegate. * ! * @param printDelegate the {@code Printable} to delegate to */ public ThreadSafePrintable(Printable printDelegate) { this.printDelegate = printDelegate; }
*** 6667,6686 **** // *** should also implement AccessibleSelection? // *** and what's up with keyboard navigation/manipulation? // /** * This class implements accessibility support for the ! * <code>JTable</code> class. It provides an implementation of the * Java Accessibility API appropriate to table user-interface elements. * <p> * <strong>Warning:</strong> * 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. 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}. */ @SuppressWarnings("serial") // Same-version serialization only protected class AccessibleJTable extends AccessibleJComponent implements AccessibleSelection, ListSelectionListener, TableModelListener, --- 6667,6686 ---- // *** should also implement AccessibleSelection? // *** and what's up with keyboard navigation/manipulation? // /** * This class implements accessibility support for the ! * {@code JTable} class. It provides an implementation of the * Java Accessibility API appropriate to table user-interface elements. * <p> * <strong>Warning:</strong> * 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. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. */ @SuppressWarnings("serial") // Same-version serialization only protected class AccessibleJTable extends AccessibleJComponent implements AccessibleSelection, ListSelectionListener, TableModelListener,
*** 7117,7134 **** public AccessibleRole getAccessibleRole() { return AccessibleRole.TABLE; } /** ! * Returns the <code>Accessible</code> child, if one exists, ! * contained at the local coordinate <code>Point</code>. * * @param p the point defining the top-left corner of the ! * <code>Accessible</code>, given in the coordinate space * of the object's parent ! * @return the <code>Accessible</code>, if it exists, ! * at the specified location; else <code>null</code> */ public Accessible getAccessibleAt(Point p) { int column = columnAtPoint(p); int row = rowAtPoint(p); --- 7117,7134 ---- public AccessibleRole getAccessibleRole() { return AccessibleRole.TABLE; } /** ! * Returns the {@code Accessible} child, if one exists, ! * contained at the local coordinate {@code Point}. * * @param p the point defining the top-left corner of the ! * {@code Accessible}, given in the coordinate space * of the object's parent ! * @return the {@code Accessible}, if it exists, ! * at the specified location; else {@code null} */ public Accessible getAccessibleAt(Point p) { int column = columnAtPoint(p); int row = rowAtPoint(p);
*** 7148,7168 **** return null; } /** * Returns the number of accessible children in the object. If all ! * of the children of this object implement <code>Accessible</code>, * then this method should return the number of children of this object. * * @return the number of accessible children in the object */ public int getAccessibleChildrenCount() { return (JTable.this.getColumnCount() * JTable.this.getRowCount()); } /** ! * Returns the nth <code>Accessible</code> child of the object. * * @param i zero-based index of child * @return the nth Accessible child of the object */ public Accessible getAccessibleChild(int i) { --- 7148,7168 ---- return null; } /** * Returns the number of accessible children in the object. If all ! * of the children of this object implement {@code Accessible}, * then this method should return the number of children of this object. * * @return the number of accessible children in the object */ public int getAccessibleChildrenCount() { return (JTable.this.getColumnCount() * JTable.this.getRowCount()); } /** ! * Returns the nth {@code Accessible} child of the object. * * @param i zero-based index of child * @return the nth Accessible child of the object */ public Accessible getAccessibleChild(int i) {
*** 7189,7199 **** } // AccessibleSelection support /** ! * Returns the number of <code>Accessible</code> children * currently selected. * If no children are selected, the return value will be 0. * * @return the number of items currently selected */ --- 7189,7199 ---- } // AccessibleSelection support /** ! * Returns the number of {@code Accessible} children * currently selected. * If no children are selected, the return value will be 0. * * @return the number of items currently selected */
*** 7225,7239 **** } } } /** ! * Returns an <code>Accessible</code> representing the * specified selected child in the object. If there * isn't a selection, or there are fewer children selected * than the integer passed in, the return ! * value will be <code>null</code>. * <p>Note that the index represents the i-th selected child, which * is different from the i-th child. * * @param i the zero-based index of selected children * @return the i-th selected child --- 7225,7239 ---- } } } /** ! * Returns an {@code Accessible} representing the * specified selected child in the object. If there * isn't a selection, or there are fewer children selected * than the integer passed in, the return ! * value will be {@code null}. * <p>Note that the index represents the i-th selected child, which * is different from the i-th child. * * @param i the zero-based index of selected children * @return the i-th selected child
*** 7359,7387 **** /** * Determines if the current child of this object is selected. * * @param i the zero-based index of the child in this ! * <code>Accessible</code> object * @return true if the current child of this object is selected * @see AccessibleContext#getAccessibleChild */ public boolean isAccessibleChildSelected(int i) { int column = getAccessibleColumnAtIndex(i); int row = getAccessibleRowAtIndex(i); return JTable.this.isCellSelected(row, column); } /** ! * Adds the specified <code>Accessible</code> child of the * object to the object's selection. If the object supports * multiple selections, the specified child is added to * any existing selection, otherwise * it replaces any existing selection in the object. If the * specified child is already selected, this method has no effect. * <p> ! * This method only works on <code>JTable</code>s which have * individual cell selection enabled. * * @param i the zero-based index of the child * @see AccessibleContext#getAccessibleChild */ --- 7359,7387 ---- /** * Determines if the current child of this object is selected. * * @param i the zero-based index of the child in this ! * {@code Accessible} object * @return true if the current child of this object is selected * @see AccessibleContext#getAccessibleChild */ public boolean isAccessibleChildSelected(int i) { int column = getAccessibleColumnAtIndex(i); int row = getAccessibleRowAtIndex(i); return JTable.this.isCellSelected(row, column); } /** ! * Adds the specified {@code Accessible} child of the * object to the object's selection. If the object supports * multiple selections, the specified child is added to * any existing selection, otherwise * it replaces any existing selection in the object. If the * specified child is already selected, this method has no effect. * <p> ! * This method only works on {@code JTable}s which have * individual cell selection enabled. * * @param i the zero-based index of the child * @see AccessibleContext#getAccessibleChild */
*** 7395,7405 **** /** * Removes the specified child of the object from the object's * selection. If the specified item isn't currently selected, this * method has no effect. * <p> ! * This method only works on <code>JTables</code> which have * individual cell selection enabled. * * @param i the zero-based index of the child * @see AccessibleContext#getAccessibleChild */ --- 7395,7405 ---- /** * Removes the specified child of the object from the object's * selection. If the specified item isn't currently selected, this * method has no effect. * <p> ! * This method only works on {@code JTables} which have * individual cell selection enabled. * * @param i the zero-based index of the child * @see AccessibleContext#getAccessibleChild */
*** 7420,7430 **** JTable.this.clearSelection(); } /** * Causes every child of the object to be selected, but only ! * if the <code>JTable</code> supports multiple selections, * and if individual cell selection is enabled. */ public void selectAllAccessibleSelection() { if (JTable.this.cellSelectionEnabled) { JTable.this.selectAll(); --- 7420,7430 ---- JTable.this.clearSelection(); } /** * Causes every child of the object to be selected, but only ! * if the {@code JTable} supports multiple selections, * and if individual cell selection is enabled. */ public void selectAllAccessibleSelection() { if (JTable.this.cellSelectionEnabled) { JTable.this.selectAll();
*** 7478,7491 **** private Accessible summary; private Accessible [] rowDescription; private Accessible [] columnDescription; /** ! * Gets the <code>AccessibleTable</code> associated with this * object. In the implementation of the Java Accessibility * API for this class, return this object, which is responsible ! * for implementing the <code>AccessibleTables</code> interface * on behalf of itself. * * @return this object * @since 1.3 */ --- 7478,7491 ---- private Accessible summary; private Accessible [] rowDescription; private Accessible [] columnDescription; /** ! * Gets the {@code AccessibleTable} associated with this * object. In the implementation of the Java Accessibility * API for this class, return this object, which is responsible ! * for implementing the {@code AccessibleTables} interface * on behalf of itself. * * @return this object * @since 1.3 */
*** 7556,7630 **** public int getAccessibleColumnCount() { return JTable.this.getColumnCount(); } /* ! * Returns the <code>Accessible</code> at a specified row * and column in the table. * * @param r zero-based row of the table * @param c zero-based column of the table ! * @return the <code>Accessible</code> at the specified row and column * in the table */ public Accessible getAccessibleAt(int r, int c) { return getAccessibleChild((r * getAccessibleColumnCount()) + c); } /** ! * Returns the number of rows occupied by the <code>Accessible</code> * at a specified row and column in the table. * ! * @return the number of rows occupied by the <code>Accessible</code> * at a specified row and column in the table * @since 1.3 */ public int getAccessibleRowExtentAt(int r, int c) { return 1; } /** * Returns the number of columns occupied by the ! * <code>Accessible</code> at a given (row, column). * ! * @return the number of columns occupied by the <code>Accessible</code> * at a specified row and column in the table * @since 1.3 */ public int getAccessibleColumnExtentAt(int r, int c) { return 1; } /** ! * Returns the row headers as an <code>AccessibleTable</code>. * ! * @return an <code>AccessibleTable</code> representing the row * headers * @since 1.3 */ public AccessibleTable getAccessibleRowHeader() { // row headers are not supported return null; } /** ! * Sets the row headers as an <code>AccessibleTable</code>. * ! * @param a an <code>AccessibleTable</code> representing the row * headers * @since 1.3 */ public void setAccessibleRowHeader(AccessibleTable a) { // row headers are not supported } /** ! * Returns the column headers as an <code>AccessibleTable</code>. * ! * @return an <code>AccessibleTable</code> representing the column ! * headers, or <code>null</code> if the table header is ! * <code>null</code> * @since 1.3 */ public AccessibleTable getAccessibleColumnHeader() { JTableHeader header = JTable.this.getTableHeader(); return header == null ? null : new AccessibleTableHeader(header); --- 7556,7630 ---- public int getAccessibleColumnCount() { return JTable.this.getColumnCount(); } /* ! * Returns the {@code Accessible} at a specified row * and column in the table. * * @param r zero-based row of the table * @param c zero-based column of the table ! * @return the {@code Accessible} at the specified row and column * in the table */ public Accessible getAccessibleAt(int r, int c) { return getAccessibleChild((r * getAccessibleColumnCount()) + c); } /** ! * Returns the number of rows occupied by the {@code Accessible} * at a specified row and column in the table. * ! * @return the number of rows occupied by the {@code Accessible} * at a specified row and column in the table * @since 1.3 */ public int getAccessibleRowExtentAt(int r, int c) { return 1; } /** * Returns the number of columns occupied by the ! * {@code Accessible} at a given (row, column). * ! * @return the number of columns occupied by the {@code Accessible} * at a specified row and column in the table * @since 1.3 */ public int getAccessibleColumnExtentAt(int r, int c) { return 1; } /** ! * Returns the row headers as an {@code AccessibleTable}. * ! * @return an {@code AccessibleTable} representing the row * headers * @since 1.3 */ public AccessibleTable getAccessibleRowHeader() { // row headers are not supported return null; } /** ! * Sets the row headers as an {@code AccessibleTable}. * ! * @param a an {@code AccessibleTable} representing the row * headers * @since 1.3 */ public void setAccessibleRowHeader(AccessibleTable a) { // row headers are not supported } /** ! * Returns the column headers as an {@code AccessibleTable}. * ! * @return an {@code AccessibleTable} representing the column ! * headers, or {@code null} if the table header is ! * {@code null} * @since 1.3 */ public AccessibleTable getAccessibleColumnHeader() { JTableHeader header = JTable.this.getTableHeader(); return header == null ? null : new AccessibleTableHeader(header);
*** 7855,7867 **** public int [] getSelectedAccessibleColumns() { return new int[0]; } } /** ! * Sets the column headers as an <code>AccessibleTable</code>. * ! * @param a an <code>AccessibleTable</code> representing the * column headers * @since 1.3 */ public void setAccessibleColumnHeader(AccessibleTable a) { // XXX not implemented --- 7855,7867 ---- public int [] getSelectedAccessibleColumns() { return new int[0]; } } /** ! * Sets the column headers as an {@code AccessibleTable}. * ! * @param a an {@code AccessibleTable} representing the * column headers * @since 1.3 */ public void setAccessibleColumnHeader(AccessibleTable a) { // XXX not implemented
*** 8058,8068 **** private int row; private int column; private int index; /** ! * Constructs an <code>AccessibleJTableHeaderEntry</code>. * * @param t a {@code JTable} * @param r an {@code int} specifying a row * @param c an {@code int} specifying a column * @param i an {@code int} specifying the index to this cell --- 8058,8068 ---- private int row; private int column; private int index; /** ! * Constructs an {@code AccessibleJTableHeaderEntry}. * * @param t a {@code JTable} * @param r an {@code int} specifying a row * @param c an {@code int} specifying a column * @param i an {@code int} specifying the index to this cell
*** 8075,8101 **** index = i; this.setAccessibleParent(parent); } /** ! * Gets the <code>AccessibleContext</code> associated with this * component. In the implementation of the Java Accessibility * API for this class, return this object, which is its own ! * <code>AccessibleContext</code>. * * @return this object */ public AccessibleContext getAccessibleContext() { return this; } /** * Gets the AccessibleContext for the table cell renderer. * ! * @return the <code>AccessibleContext</code> for the table * cell renderer if one exists; ! * otherwise, returns <code>null</code>. * @since 1.6 */ protected AccessibleContext getCurrentAccessibleContext() { TableColumn aColumn = getColumnModel().getColumn(column); TableCellRenderer renderer = aColumn.getCellRenderer(); --- 8075,8101 ---- index = i; this.setAccessibleParent(parent); } /** ! * Gets the {@code AccessibleContext} associated with this * component. In the implementation of the Java Accessibility * API for this class, return this object, which is its own ! * {@code AccessibleContext}. * * @return this object */ public AccessibleContext getAccessibleContext() { return this; } /** * Gets the AccessibleContext for the table cell renderer. * ! * @return the {@code AccessibleContext} for the table * cell renderer if one exists; ! * otherwise, returns {@code null}. * @since 1.6 */ protected AccessibleContext getCurrentAccessibleContext() { TableColumn aColumn = getColumnModel().getColumn(column); TableCellRenderer renderer = aColumn.getCellRenderer();
*** 8115,8125 **** /** * Gets the table cell renderer component. * * @return the table cell renderer component if one exists; ! * otherwise, returns <code>null</code>. * @since 1.6 */ protected Component getCurrentComponent() { TableColumn aColumn = getColumnModel().getColumn(column); TableCellRenderer renderer = aColumn.getCellRenderer(); --- 8115,8125 ---- /** * Gets the table cell renderer component. * * @return the table cell renderer component if one exists; ! * otherwise, returns {@code null}. * @since 1.6 */ protected Component getCurrentComponent() { TableColumn aColumn = getColumnModel().getColumn(column); TableCellRenderer renderer = aColumn.getCellRenderer();
*** 8135,8145 **** // AccessibleContext methods /** * Gets the accessible name of this object. * ! * @return the localized name of the object; <code>null</code> * if this object does not have a name */ public String getAccessibleName() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 8135,8145 ---- // AccessibleContext methods /** * Gets the accessible name of this object. * ! * @return the localized name of the object; {@code null} * if this object does not have a name */ public String getAccessibleName() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 8176,8186 **** // /** * Gets the accessible description of this object. * * @return the localized description of the object; ! * <code>null</code> if this object does not have * a description */ public String getAccessibleDescription() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 8176,8186 ---- // /** * Gets the accessible description of this object. * * @return the localized description of the object; ! * {@code null} if this object does not have * a description */ public String getAccessibleDescription() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 8205,8215 **** } /** * Gets the role of this object. * ! * @return an instance of <code>AccessibleRole</code> * describing the role of the object * @see AccessibleRole */ public AccessibleRole getAccessibleRole() { AccessibleContext ac = getCurrentAccessibleContext(); --- 8205,8215 ---- } /** * Gets the role of this object. * ! * @return an instance of {@code AccessibleRole} * describing the role of the object * @see AccessibleRole */ public AccessibleRole getAccessibleRole() { AccessibleContext ac = getCurrentAccessibleContext();
*** 8221,8231 **** } /** * Gets the state set of this object. * ! * @return an instance of <code>AccessibleStateSet</code> * containing the current state set of the object * @see AccessibleState */ public AccessibleStateSet getAccessibleStateSet() { AccessibleContext ac = getCurrentAccessibleContext(); --- 8221,8231 ---- } /** * Gets the state set of this object. * ! * @return an instance of {@code AccessibleStateSet} * containing the current state set of the object * @see AccessibleState */ public AccessibleStateSet getAccessibleStateSet() { AccessibleContext ac = getCurrentAccessibleContext();
*** 8257,8271 **** as.add(AccessibleState.TRANSIENT); return as; } /** ! * Gets the <code>Accessible</code> parent of this object. * * @return the Accessible parent of this object; ! * <code>null</code> if this object does not ! * have an <code>Accessible</code> parent */ public Accessible getAccessibleParent() { return parent; } --- 8257,8271 ---- as.add(AccessibleState.TRANSIENT); return as; } /** ! * Gets the {@code Accessible} parent of this object. * * @return the Accessible parent of this object; ! * {@code null} if this object does not ! * have an {@code Accessible} parent */ public Accessible getAccessibleParent() { return parent; }
*** 8293,8307 **** return 0; } } /** ! * Returns the specified <code>Accessible</code> child of the * object. * * @param i zero-based index of child ! * @return the <code>Accessible</code> child of the object */ public Accessible getAccessibleChild(int i) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { Accessible accessibleChild = ac.getAccessibleChild(i); --- 8293,8307 ---- return 0; } } /** ! * Returns the specified {@code Accessible} child of the * object. * * @param i zero-based index of child ! * @return the {@code Accessible} child of the object */ public Accessible getAccessibleChild(int i) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { Accessible accessibleChild = ac.getAccessibleChild(i);
*** 8318,8328 **** * is returned. * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned * @exception IllegalComponentStateException if the ! * <code>Component</code> does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the * containing parent * @see #setLocale */ --- 8318,8328 ---- * is returned. * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned * @exception IllegalComponentStateException if the ! * {@code Component} does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the * containing parent * @see #setLocale */
*** 8334,8347 **** return null; } } /** ! * Adds a <code>PropertyChangeListener</code> to the listener list. * The listener is registered for all properties. * ! * @param l the <code>PropertyChangeListener</code> * to be added */ public void addPropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 8334,8347 ---- return null; } } /** ! * Adds a {@code PropertyChangeListener} to the listener list. * The listener is registered for all properties. * ! * @param l the {@code PropertyChangeListener} * to be added */ public void addPropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 8350,8364 **** super.addPropertyChangeListener(l); } } /** ! * Removes a <code>PropertyChangeListener</code> from the ! * listener list. This removes a <code>PropertyChangeListener</code> * that was registered for all properties. * ! * @param l the <code>PropertyChangeListener</code> * to be removed */ public void removePropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 8350,8364 ---- super.addPropertyChangeListener(l); } } /** ! * Removes a {@code PropertyChangeListener} from the ! * listener list. This removes a {@code PropertyChangeListener} * that was registered for all properties. * ! * @param l the {@code PropertyChangeListener} * to be removed */ public void removePropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 8367,8422 **** super.removePropertyChangeListener(l); } } /** ! * Gets the <code>AccessibleAction</code> associated with this ! * object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleAction</code>, or <code>null</code> */ public AccessibleAction getAccessibleAction() { return getCurrentAccessibleContext().getAccessibleAction(); } /** ! * Gets the <code>AccessibleComponent</code> associated with ! * this object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleComponent</code>, or ! * <code>null</code> */ public AccessibleComponent getAccessibleComponent() { return this; // to override getBounds() } /** ! * Gets the <code>AccessibleSelection</code> associated with ! * this object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleSelection</code>, or ! * <code>null</code> */ public AccessibleSelection getAccessibleSelection() { return getCurrentAccessibleContext().getAccessibleSelection(); } /** ! * Gets the <code>AccessibleText</code> associated with this ! * object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleText</code>, or <code>null</code> */ public AccessibleText getAccessibleText() { return getCurrentAccessibleContext().getAccessibleText(); } /** ! * Gets the <code>AccessibleValue</code> associated with ! * this object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleValue</code>, or <code>null</code> */ public AccessibleValue getAccessibleValue() { return getCurrentAccessibleContext().getAccessibleValue(); } --- 8367,8422 ---- super.removePropertyChangeListener(l); } } /** ! * Gets the {@code AccessibleAction} associated with this ! * object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleAction}, or {@code null} */ public AccessibleAction getAccessibleAction() { return getCurrentAccessibleContext().getAccessibleAction(); } /** ! * Gets the {@code AccessibleComponent} associated with ! * this object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleComponent}, or ! * {@code null} */ public AccessibleComponent getAccessibleComponent() { return this; // to override getBounds() } /** ! * Gets the {@code AccessibleSelection} associated with ! * this object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleSelection}, or ! * {@code null} */ public AccessibleSelection getAccessibleSelection() { return getCurrentAccessibleContext().getAccessibleSelection(); } /** ! * Gets the {@code AccessibleText} associated with this ! * object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleText}, or {@code null} */ public AccessibleText getAccessibleText() { return getCurrentAccessibleContext().getAccessibleText(); } /** ! * Gets the {@code AccessibleValue} associated with ! * this object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleValue}, or {@code null} */ public AccessibleValue getAccessibleValue() { return getCurrentAccessibleContext().getAccessibleValue(); }
*** 8425,8435 **** /** * Gets the background color of this object. * * @return the background color, if supported, of the object; ! * otherwise, <code>null</code> */ public Color getBackground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getBackground(); --- 8425,8435 ---- /** * Gets the background color of this object. * * @return the background color, if supported, of the object; ! * otherwise, {@code null} */ public Color getBackground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getBackground();
*** 8444,8454 **** } /** * Sets the background color of this object. * ! * @param c the new <code>Color</code> for the background */ public void setBackground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setBackground(c); --- 8444,8454 ---- } /** * Sets the background color of this object. * ! * @param c the new {@code Color} for the background */ public void setBackground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setBackground(c);
*** 8462,8472 **** /** * Gets the foreground color of this object. * * @return the foreground color, if supported, of the object; ! * otherwise, <code>null</code> */ public Color getForeground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getForeground(); --- 8462,8472 ---- /** * Gets the foreground color of this object. * * @return the foreground color, if supported, of the object; ! * otherwise, {@code null} */ public Color getForeground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getForeground();
*** 8481,8491 **** } /** * Sets the foreground color of this object. * ! * @param c the new <code>Color</code> for the foreground */ public void setForeground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setForeground(c); --- 8481,8491 ---- } /** * Sets the foreground color of this object. * ! * @param c the new {@code Color} for the foreground */ public void setForeground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setForeground(c);
*** 8496,8509 **** } } } /** ! * Gets the <code>Cursor</code> of this object. * ! * @return the <code>Cursor</code>, if supported, ! * of the object; otherwise, <code>null</code> */ public Cursor getCursor() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getCursor(); --- 8496,8509 ---- } } } /** ! * Gets the {@code Cursor} of this object. * ! * @return the {@code Cursor}, if supported, ! * of the object; otherwise, {@code null} */ public Cursor getCursor() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getCursor();
*** 8521,8533 **** } } } /** ! * Sets the <code>Cursor</code> of this object. * ! * @param c the new <code>Cursor</code> for the object */ public void setCursor(Cursor c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setCursor(c); --- 8521,8533 ---- } } } /** ! * Sets the {@code Cursor} of this object. * ! * @param c the new {@code Cursor} for the object */ public void setCursor(Cursor c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setCursor(c);
*** 8538,8551 **** } } } /** ! * Gets the <code>Font</code> of this object. * ! * @return the <code>Font</code>,if supported, ! * for the object; otherwise, <code>null</code> */ public Font getFont() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getFont(); --- 8538,8551 ---- } } } /** ! * Gets the {@code Font} of this object. * ! * @return the {@code Font},if supported, ! * for the object; otherwise, {@code null} */ public Font getFont() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getFont();
*** 8558,8570 **** } } } /** ! * Sets the <code>Font</code> of this object. * ! * @param f the new <code>Font</code> for the object */ public void setFont(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setFont(f); --- 8558,8570 ---- } } } /** ! * Sets the {@code Font} of this object. * ! * @param f the new {@code Font} for the object */ public void setFont(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setFont(f);
*** 8575,8589 **** } } } /** ! * Gets the <code>FontMetrics</code> of this object. * ! * @param f the <code>Font</code> ! * @return the <code>FontMetrics</code> object, if supported; ! * otherwise <code>null</code> * @see #getFont */ public FontMetrics getFontMetrics(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { --- 8575,8589 ---- } } } /** ! * Gets the {@code FontMetrics} of this object. * ! * @param f the {@code Font} ! * @return the {@code FontMetrics} object, if supported; ! * otherwise {@code null} * @see #getFont */ public FontMetrics getFontMetrics(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) {
*** 8637,8647 **** /** * Determines if this object is visible. Note: this means that the * object intends to be visible; however, it may not in fact be * showing on the screen because one of the objects that this object * is contained by is not visible. To determine if an object is ! * showing on the screen, use <code>isShowing</code>. * * @return true if object is visible; otherwise, false */ public boolean isVisible() { AccessibleContext ac = getCurrentAccessibleContext(); --- 8637,8647 ---- /** * Determines if this object is visible. Note: this means that the * object intends to be visible; however, it may not in fact be * showing on the screen because one of the objects that this object * is contained by is not visible. To determine if an object is ! * showing on the screen, use {@code isShowing}. * * @return true if object is visible; otherwise, false */ public boolean isVisible() { AccessibleContext ac = getCurrentAccessibleContext();
*** 8708,8720 **** * Checks whether the specified point is within this * object's bounds, where the point's x and y coordinates * are defined to be relative to the coordinate system of * the object. * ! * @param p the <code>Point</code> relative to the * coordinate system of the object ! * @return true if object contains <code>Point</code>; * otherwise false */ public boolean contains(Point p) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { --- 8708,8720 ---- * Checks whether the specified point is within this * object's bounds, where the point's x and y coordinates * are defined to be relative to the coordinate system of * the object. * ! * @param p the {@code Point} relative to the * coordinate system of the object ! * @return true if object contains {@code Point}; * otherwise false */ public boolean contains(Point p) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) {
*** 8733,8743 **** /** * Returns the location of the object on the screen. * * @return location of object on screen -- can be ! * <code>null</code> if this object is not on the screen */ public Point getLocationOnScreen() { if (parent != null && parent.isShowing()) { Point parentLocation = parent.getLocationOnScreen(); Point componentLocation = getLocation(); --- 8733,8743 ---- /** * Returns the location of the object on the screen. * * @return location of object on screen -- can be ! * {@code null} if this object is not on the screen */ public Point getLocationOnScreen() { if (parent != null && parent.isShowing()) { Point parentLocation = parent.getLocationOnScreen(); Point componentLocation = getLocation();
*** 8751,8763 **** /** * Gets the location of the object relative to the parent * in the form of a point specifying the object's * top-left corner in the screen's coordinate space. * ! * @return an instance of <code>Point</code> representing * the top-left corner of the object's bounds in the ! * coordinate space of the screen; <code>null</code> if * this object or its parent are not on the screen */ public Point getLocation() { if (parent != null) { Rectangle r = parent.getCellRect(row, column, false); --- 8751,8763 ---- /** * Gets the location of the object relative to the parent * in the form of a point specifying the object's * top-left corner in the screen's coordinate space. * ! * @return an instance of {@code Point} representing * the top-left corner of the object's bounds in the ! * coordinate space of the screen; {@code null} if * this object or its parent are not on the screen */ public Point getLocation() { if (parent != null) { Rectangle r = parent.getCellRect(row, column, false);
*** 8893,8903 **** private int column; private JTableHeader parent; private Component rendererComponent; /** ! * Constructs an <code>AccessibleJTableHeaderEntry</code> instance. * * @param row header cell row index * @param column header cell column index * @param parent header cell parent * @param rendererComponent component that renders the header cell --- 8893,8903 ---- private int column; private JTableHeader parent; private Component rendererComponent; /** ! * Constructs an {@code AccessibleJTableHeaderEntry} instance. * * @param row header cell row index * @param column header cell column index * @param parent header cell parent * @param rendererComponent component that renders the header cell
*** 8911,8924 **** this.rendererComponent = rendererComponent; this.setAccessibleParent(parent); } /** ! * Gets the <code>AccessibleContext</code> associated with this * component. In the implementation of the Java Accessibility * API for this class, return this object, which is its own ! * <code>AccessibleContext</code>. * * @return this object */ public AccessibleContext getAccessibleContext() { return this; --- 8911,8924 ---- this.rendererComponent = rendererComponent; this.setAccessibleParent(parent); } /** ! * Gets the {@code AccessibleContext} associated with this * component. In the implementation of the Java Accessibility * API for this class, return this object, which is its own ! * {@code AccessibleContext}. * * @return this object */ public AccessibleContext getAccessibleContext() { return this;
*** 8942,8952 **** // AccessibleContext methods ========== /** * Gets the accessible name of this object. * ! * @return the localized name of the object; <code>null</code> * if this object does not have a name */ public String getAccessibleName() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 8942,8952 ---- // AccessibleContext methods ========== /** * Gets the accessible name of this object. * ! * @return the localized name of the object; {@code null} * if this object does not have a name */ public String getAccessibleName() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 8978,8988 **** /** * Gets the accessible description of this object. * * @return the localized description of the object; ! * <code>null</code> if this object does not have * a description */ public String getAccessibleDescription() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 8978,8988 ---- /** * Gets the accessible description of this object. * * @return the localized description of the object; ! * {@code null} if this object does not have * a description */ public String getAccessibleDescription() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 9007,9017 **** } /** * Gets the role of this object. * ! * @return an instance of <code>AccessibleRole</code> * describing the role of the object * @see AccessibleRole */ public AccessibleRole getAccessibleRole() { AccessibleContext ac = getCurrentAccessibleContext(); --- 9007,9017 ---- } /** * Gets the role of this object. * ! * @return an instance of {@code AccessibleRole} * describing the role of the object * @see AccessibleRole */ public AccessibleRole getAccessibleRole() { AccessibleContext ac = getCurrentAccessibleContext();
*** 9023,9033 **** } /** * Gets the state set of this object. * ! * @return an instance of <code>AccessibleStateSet</code> * containing the current state set of the object * @see AccessibleState */ public AccessibleStateSet getAccessibleStateSet() { AccessibleContext ac = getCurrentAccessibleContext(); --- 9023,9033 ---- } /** * Gets the state set of this object. * ! * @return an instance of {@code AccessibleStateSet} * containing the current state set of the object * @see AccessibleState */ public AccessibleStateSet getAccessibleStateSet() { AccessibleContext ac = getCurrentAccessibleContext();
*** 9059,9073 **** as.add(AccessibleState.TRANSIENT); return as; } /** ! * Gets the <code>Accessible</code> parent of this object. * * @return the Accessible parent of this object; ! * <code>null</code> if this object does not ! * have an <code>Accessible</code> parent */ public Accessible getAccessibleParent() { return parent; } --- 9059,9073 ---- as.add(AccessibleState.TRANSIENT); return as; } /** ! * Gets the {@code Accessible} parent of this object. * * @return the Accessible parent of this object; ! * {@code null} if this object does not ! * have an {@code Accessible} parent */ public Accessible getAccessibleParent() { return parent; }
*** 9095,9109 **** return 0; } } /** ! * Returns the specified <code>Accessible</code> child of the * object. * * @param i zero-based index of child ! * @return the <code>Accessible</code> child of the object */ public Accessible getAccessibleChild(int i) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { Accessible accessibleChild = ac.getAccessibleChild(i); --- 9095,9109 ---- return 0; } } /** ! * Returns the specified {@code Accessible} child of the * object. * * @param i zero-based index of child ! * @return the {@code Accessible} child of the object */ public Accessible getAccessibleChild(int i) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { Accessible accessibleChild = ac.getAccessibleChild(i);
*** 9120,9130 **** * is returned. * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned * @exception IllegalComponentStateException if the ! * <code>Component</code> does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the * containing parent * @see #setLocale */ --- 9120,9130 ---- * is returned. * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned * @exception IllegalComponentStateException if the ! * {@code Component} does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the * containing parent * @see #setLocale */
*** 9136,9149 **** return null; } } /** ! * Adds a <code>PropertyChangeListener</code> to the listener list. * The listener is registered for all properties. * ! * @param l the <code>PropertyChangeListener</code> * to be added */ public void addPropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 9136,9149 ---- return null; } } /** ! * Adds a {@code PropertyChangeListener} to the listener list. * The listener is registered for all properties. * ! * @param l the {@code PropertyChangeListener} * to be added */ public void addPropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 9152,9166 **** super.addPropertyChangeListener(l); } } /** ! * Removes a <code>PropertyChangeListener</code> from the ! * listener list. This removes a <code>PropertyChangeListener</code> * that was registered for all properties. * ! * @param l the <code>PropertyChangeListener</code> * to be removed */ public void removePropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) { --- 9152,9166 ---- super.addPropertyChangeListener(l); } } /** ! * Removes a {@code PropertyChangeListener} from the ! * listener list. This removes a {@code PropertyChangeListener} * that was registered for all properties. * ! * @param l the {@code PropertyChangeListener} * to be removed */ public void removePropertyChangeListener(PropertyChangeListener l) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac != null) {
*** 9169,9224 **** super.removePropertyChangeListener(l); } } /** ! * Gets the <code>AccessibleAction</code> associated with this ! * object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleAction</code>, or <code>null</code> */ public AccessibleAction getAccessibleAction() { return getCurrentAccessibleContext().getAccessibleAction(); } /** ! * Gets the <code>AccessibleComponent</code> associated with ! * this object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleComponent</code>, or ! * <code>null</code> */ public AccessibleComponent getAccessibleComponent() { return this; // to override getBounds() } /** ! * Gets the <code>AccessibleSelection</code> associated with ! * this object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleSelection</code>, or ! * <code>null</code> */ public AccessibleSelection getAccessibleSelection() { return getCurrentAccessibleContext().getAccessibleSelection(); } /** ! * Gets the <code>AccessibleText</code> associated with this ! * object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleText</code>, or <code>null</code> */ public AccessibleText getAccessibleText() { return getCurrentAccessibleContext().getAccessibleText(); } /** ! * Gets the <code>AccessibleValue</code> associated with ! * this object if one exists. Otherwise returns <code>null</code>. * ! * @return the <code>AccessibleValue</code>, or <code>null</code> */ public AccessibleValue getAccessibleValue() { return getCurrentAccessibleContext().getAccessibleValue(); } --- 9169,9224 ---- super.removePropertyChangeListener(l); } } /** ! * Gets the {@code AccessibleAction} associated with this ! * object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleAction}, or {@code null} */ public AccessibleAction getAccessibleAction() { return getCurrentAccessibleContext().getAccessibleAction(); } /** ! * Gets the {@code AccessibleComponent} associated with ! * this object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleComponent}, or ! * {@code null} */ public AccessibleComponent getAccessibleComponent() { return this; // to override getBounds() } /** ! * Gets the {@code AccessibleSelection} associated with ! * this object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleSelection}, or ! * {@code null} */ public AccessibleSelection getAccessibleSelection() { return getCurrentAccessibleContext().getAccessibleSelection(); } /** ! * Gets the {@code AccessibleText} associated with this ! * object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleText}, or {@code null} */ public AccessibleText getAccessibleText() { return getCurrentAccessibleContext().getAccessibleText(); } /** ! * Gets the {@code AccessibleValue} associated with ! * this object if one exists. Otherwise returns {@code null}. * ! * @return the {@code AccessibleValue}, or {@code null} */ public AccessibleValue getAccessibleValue() { return getCurrentAccessibleContext().getAccessibleValue(); }
*** 9227,9237 **** /** * Gets the background color of this object. * * @return the background color, if supported, of the object; ! * otherwise, <code>null</code> */ public Color getBackground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getBackground(); --- 9227,9237 ---- /** * Gets the background color of this object. * * @return the background color, if supported, of the object; ! * otherwise, {@code null} */ public Color getBackground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getBackground();
*** 9246,9256 **** } /** * Sets the background color of this object. * ! * @param c the new <code>Color</code> for the background */ public void setBackground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setBackground(c); --- 9246,9256 ---- } /** * Sets the background color of this object. * ! * @param c the new {@code Color} for the background */ public void setBackground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setBackground(c);
*** 9264,9274 **** /** * Gets the foreground color of this object. * * @return the foreground color, if supported, of the object; ! * otherwise, <code>null</code> */ public Color getForeground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getForeground(); --- 9264,9274 ---- /** * Gets the foreground color of this object. * * @return the foreground color, if supported, of the object; ! * otherwise, {@code null} */ public Color getForeground() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getForeground();
*** 9283,9293 **** } /** * Sets the foreground color of this object. * ! * @param c the new <code>Color</code> for the foreground */ public void setForeground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setForeground(c); --- 9283,9293 ---- } /** * Sets the foreground color of this object. * ! * @param c the new {@code Color} for the foreground */ public void setForeground(Color c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setForeground(c);
*** 9298,9311 **** } } } /** ! * Gets the <code>Cursor</code> of this object. * ! * @return the <code>Cursor</code>, if supported, ! * of the object; otherwise, <code>null</code> */ public Cursor getCursor() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getCursor(); --- 9298,9311 ---- } } } /** ! * Gets the {@code Cursor} of this object. * ! * @return the {@code Cursor}, if supported, ! * of the object; otherwise, {@code null} */ public Cursor getCursor() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getCursor();
*** 9323,9335 **** } } } /** ! * Sets the <code>Cursor</code> of this object. * ! * @param c the new <code>Cursor</code> for the object */ public void setCursor(Cursor c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setCursor(c); --- 9323,9335 ---- } } } /** ! * Sets the {@code Cursor} of this object. * ! * @param c the new {@code Cursor} for the object */ public void setCursor(Cursor c) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setCursor(c);
*** 9340,9353 **** } } } /** ! * Gets the <code>Font</code> of this object. * ! * @return the <code>Font</code>,if supported, ! * for the object; otherwise, <code>null</code> */ public Font getFont() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getFont(); --- 9340,9353 ---- } } } /** ! * Gets the {@code Font} of this object. * ! * @return the {@code Font},if supported, ! * for the object; otherwise, {@code null} */ public Font getFont() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { return ((AccessibleComponent) ac).getFont();
*** 9360,9372 **** } } } /** ! * Sets the <code>Font</code> of this object. * ! * @param f the new <code>Font</code> for the object */ public void setFont(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setFont(f); --- 9360,9372 ---- } } } /** ! * Sets the {@code Font} of this object. * ! * @param f the new {@code Font} for the object */ public void setFont(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { ((AccessibleComponent) ac).setFont(f);
*** 9377,9391 **** } } } /** ! * Gets the <code>FontMetrics</code> of this object. * ! * @param f the <code>Font</code> ! * @return the <code>FontMetrics</code> object, if supported; ! * otherwise <code>null</code> * @see #getFont */ public FontMetrics getFontMetrics(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { --- 9377,9391 ---- } } } /** ! * Gets the {@code FontMetrics} of this object. * ! * @param f the {@code Font} ! * @return the {@code FontMetrics} object, if supported; ! * otherwise {@code null} * @see #getFont */ public FontMetrics getFontMetrics(Font f) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) {
*** 9439,9449 **** /** * Determines if this object is visible. Note: this means that the * object intends to be visible; however, it may not in fact be * showing on the screen because one of the objects that this object * is contained by is not visible. To determine if an object is ! * showing on the screen, use <code>isShowing</code>. * * @return true if object is visible; otherwise, false */ public boolean isVisible() { AccessibleContext ac = getCurrentAccessibleContext(); --- 9439,9449 ---- /** * Determines if this object is visible. Note: this means that the * object intends to be visible; however, it may not in fact be * showing on the screen because one of the objects that this object * is contained by is not visible. To determine if an object is ! * showing on the screen, use {@code isShowing}. * * @return true if object is visible; otherwise, false */ public boolean isVisible() { AccessibleContext ac = getCurrentAccessibleContext();
*** 9510,9522 **** * Checks whether the specified point is within this * object's bounds, where the point's x and y coordinates * are defined to be relative to the coordinate system of * the object. * ! * @param p the <code>Point</code> relative to the * coordinate system of the object ! * @return true if object contains <code>Point</code>; * otherwise false */ public boolean contains(Point p) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { --- 9510,9522 ---- * Checks whether the specified point is within this * object's bounds, where the point's x and y coordinates * are defined to be relative to the coordinate system of * the object. * ! * @param p the {@code Point} relative to the * coordinate system of the object ! * @return true if object contains {@code Point}; * otherwise false */ public boolean contains(Point p) { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) {
*** 9535,9545 **** /** * Returns the location of the object on the screen. * * @return location of object on screen -- can be ! * <code>null</code> if this object is not on the screen */ public Point getLocationOnScreen() { if (parent != null && parent.isShowing()) { Point parentLocation = parent.getLocationOnScreen(); Point componentLocation = getLocation(); --- 9535,9545 ---- /** * Returns the location of the object on the screen. * * @return location of object on screen -- can be ! * {@code null} if this object is not on the screen */ public Point getLocationOnScreen() { if (parent != null && parent.isShowing()) { Point parentLocation = parent.getLocationOnScreen(); Point componentLocation = getLocation();
*** 9553,9565 **** /** * Gets the location of the object relative to the parent * in the form of a point specifying the object's * top-left corner in the screen's coordinate space. * ! * @return an instance of <code>Point</code> representing * the top-left corner of the object's bounds in the ! * coordinate space of the screen; <code>null</code> if * this object or its parent are not on the screen */ public Point getLocation() { if (parent != null) { Rectangle r = parent.getHeaderRect(column); --- 9553,9565 ---- /** * Gets the location of the object relative to the parent * in the form of a point specifying the object's * top-left corner in the screen's coordinate space. * ! * @return an instance of {@code Point} representing * the top-left corner of the object's bounds in the ! * coordinate space of the screen; {@code null} if * this object or its parent are not on the screen */ public Point getLocation() { if (parent != null) { Rectangle r = parent.getHeaderRect(column);
< prev index next >