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

Print this page




 326     protected Dimension         preferredViewportSize;
 327 
 328     /** True if row selection is allowed in this table. */
 329     protected boolean           rowSelectionAllowed;
 330 
 331     /**
 332      * Obsolete as of Java 2 platform v1.3.  Please use the
 333      * <code>rowSelectionAllowed</code> property and the
 334      * <code>columnSelectionAllowed</code> property of the
 335      * <code>columnModel</code> instead. Or use the
 336      * method <code>getCellSelectionEnabled</code>.
 337      */
 338     /*
 339      * If true, both a row selection and a column selection
 340      * can be non-empty at the same time, the selected cells are the
 341      * the cells whose row and column are both selected.
 342      */
 343     protected boolean           cellSelectionEnabled;
 344 
 345     /** If editing, the <code>Component</code> that is handling the editing. */
 346     transient protected Component       editorComp;
 347 
 348     /**
 349      * The active cell editor object, that overwrites the screen real estate
 350      * occupied by the current cell and allows the user to change its contents.
 351      * {@code null} if the table isn't currently editing.
 352      */
 353     transient protected TableCellEditor cellEditor;
 354 
 355     /** Identifies the column of the cell being edited. */
 356     transient protected int             editingColumn;
 357 
 358     /** Identifies the row of the cell being edited. */
 359     transient protected int             editingRow;
 360 
 361    /**
 362      * A table of objects that display the contents of a cell,
 363      * indexed by class as declared in <code>getColumnClass</code>
 364      * in the <code>TableModel</code> interface.
 365      */
 366     transient protected Hashtable<Object, Object> defaultRenderersByColumnClass;
 367     // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>.
 368     // It is declared otherwise to accomodate using UIDefaults.
 369 
 370     /**
 371      * A table of objects that display and edit the contents of a cell,
 372      * indexed by class as declared in <code>getColumnClass</code>
 373      * in the <code>TableModel</code> interface.
 374      */
 375     transient protected Hashtable<Object, Object> defaultEditorsByColumnClass;
 376     // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>.
 377     // It is declared otherwise to accomodate using UIDefaults.
 378 
 379     /** The foreground color of selected cells. */
 380     protected Color selectionForeground;
 381 
 382     /** The background color of selected cells. */
 383     protected Color selectionBackground;
 384 
 385 //
 386 // Private state
 387 //
 388 
 389     // WARNING: If you directly access this field you should also change the
 390     // SortManager.modelRowSizes field as well.
 391     private SizeSequence rowModel;
 392     private boolean dragEnabled;
 393     private boolean surrendersFocusOnKeystroke;
 394     private PropertyChangeListener editorRemover = null;
 395     /**


 863                 isRowHeightSet = false;
 864             }
 865             return;
 866         }
 867         super.setUIProperty(propertyName, value);
 868     }
 869 
 870 //
 871 // Static Methods
 872 //
 873 
 874     /**
 875      * Equivalent to <code>new JScrollPane(aTable)</code>.
 876      *
 877      * @param aTable a {@code JTable} to be used for the scroll pane
 878      * @return a {@code JScrollPane} created using {@code aTable}
 879      * @deprecated As of Swing version 1.0.2,
 880      * replaced by <code>new JScrollPane(aTable)</code>.
 881      */
 882     @Deprecated
 883     static public JScrollPane createScrollPaneForTable(JTable aTable) {
 884         return new JScrollPane(aTable);
 885     }
 886 
 887 //
 888 // Table Attributes
 889 //
 890 
 891     /**
 892      * Sets the <code>tableHeader</code> working with this <code>JTable</code> to <code>newHeader</code>.
 893      * It is legal to have a <code>null</code> <code>tableHeader</code>.
 894      *
 895      * @param   tableHeader                       new tableHeader
 896      * @see     #getTableHeader
 897      * @beaninfo
 898      *  bound: true
 899      *  description: The JTableHeader instance which renders the column headers.
 900      */
 901     public void setTableHeader(JTableHeader tableHeader) {
 902         if (this.tableHeader != tableHeader) {
 903             JTableHeader old = this.tableHeader;




 326     protected Dimension         preferredViewportSize;
 327 
 328     /** True if row selection is allowed in this table. */
 329     protected boolean           rowSelectionAllowed;
 330 
 331     /**
 332      * Obsolete as of Java 2 platform v1.3.  Please use the
 333      * <code>rowSelectionAllowed</code> property and the
 334      * <code>columnSelectionAllowed</code> property of the
 335      * <code>columnModel</code> instead. Or use the
 336      * method <code>getCellSelectionEnabled</code>.
 337      */
 338     /*
 339      * If true, both a row selection and a column selection
 340      * can be non-empty at the same time, the selected cells are the
 341      * the cells whose row and column are both selected.
 342      */
 343     protected boolean           cellSelectionEnabled;
 344 
 345     /** If editing, the <code>Component</code> that is handling the editing. */
 346     protected transient Component       editorComp;
 347 
 348     /**
 349      * The active cell editor object, that overwrites the screen real estate
 350      * occupied by the current cell and allows the user to change its contents.
 351      * {@code null} if the table isn't currently editing.
 352      */
 353     protected transient TableCellEditor cellEditor;
 354 
 355     /** Identifies the column of the cell being edited. */
 356     protected transient int             editingColumn;
 357 
 358     /** Identifies the row of the cell being edited. */
 359     protected transient int             editingRow;
 360 
 361    /**
 362      * A table of objects that display the contents of a cell,
 363      * indexed by class as declared in <code>getColumnClass</code>
 364      * in the <code>TableModel</code> interface.
 365      */
 366     protected transient Hashtable<Object, Object> defaultRenderersByColumnClass;
 367     // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>.
 368     // It is declared otherwise to accomodate using UIDefaults.
 369 
 370     /**
 371      * A table of objects that display and edit the contents of a cell,
 372      * indexed by class as declared in <code>getColumnClass</code>
 373      * in the <code>TableModel</code> interface.
 374      */
 375     protected transient Hashtable<Object, Object> defaultEditorsByColumnClass;
 376     // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>.
 377     // It is declared otherwise to accomodate using UIDefaults.
 378 
 379     /** The foreground color of selected cells. */
 380     protected Color selectionForeground;
 381 
 382     /** The background color of selected cells. */
 383     protected Color selectionBackground;
 384 
 385 //
 386 // Private state
 387 //
 388 
 389     // WARNING: If you directly access this field you should also change the
 390     // SortManager.modelRowSizes field as well.
 391     private SizeSequence rowModel;
 392     private boolean dragEnabled;
 393     private boolean surrendersFocusOnKeystroke;
 394     private PropertyChangeListener editorRemover = null;
 395     /**


 863                 isRowHeightSet = false;
 864             }
 865             return;
 866         }
 867         super.setUIProperty(propertyName, value);
 868     }
 869 
 870 //
 871 // Static Methods
 872 //
 873 
 874     /**
 875      * Equivalent to <code>new JScrollPane(aTable)</code>.
 876      *
 877      * @param aTable a {@code JTable} to be used for the scroll pane
 878      * @return a {@code JScrollPane} created using {@code aTable}
 879      * @deprecated As of Swing version 1.0.2,
 880      * replaced by <code>new JScrollPane(aTable)</code>.
 881      */
 882     @Deprecated
 883     public static JScrollPane createScrollPaneForTable(JTable aTable) {
 884         return new JScrollPane(aTable);
 885     }
 886 
 887 //
 888 // Table Attributes
 889 //
 890 
 891     /**
 892      * Sets the <code>tableHeader</code> working with this <code>JTable</code> to <code>newHeader</code>.
 893      * It is legal to have a <code>null</code> <code>tableHeader</code>.
 894      *
 895      * @param   tableHeader                       new tableHeader
 896      * @see     #getTableHeader
 897      * @beaninfo
 898      *  bound: true
 899      *  description: The JTableHeader instance which renders the column headers.
 900      */
 901     public void setTableHeader(JTableHeader tableHeader) {
 902         if (this.tableHeader != tableHeader) {
 903             JTableHeader old = this.tableHeader;