< prev index next >

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

Print this page




5793         return editor;
5794     }
5795 
5796 
5797     /**
5798      * Prepares the editor by querying the data model for the value and
5799      * selection state of the cell at <code>row</code>, <code>column</code>.
5800      * <p>
5801      * <b>Note:</b>
5802      * Throughout the table package, the internal implementations always
5803      * use this method to prepare editors so that this default behavior
5804      * can be safely overridden by a subclass.
5805      *
5806      * @param editor  the <code>TableCellEditor</code> to set up
5807      * @param row     the row of the cell to edit,
5808      *                where 0 is the first row
5809      * @param column  the column of the cell to edit,
5810      *                where 0 is the first column
5811      * @return the <code>Component</code> being edited
5812      */

5813     public Component prepareEditor(TableCellEditor editor, int row, int column) {
5814         Object value = getValueAt(row, column);
5815         boolean isSelected = isCellSelected(row, column);
5816         Component comp = editor.getTableCellEditorComponent(this, value, isSelected,
5817                                                   row, column);
5818         if (comp instanceof JComponent) {
5819             JComponent jComp = (JComponent)comp;
5820             if (jComp.getNextFocusableComponent() == null) {
5821                 jComp.setNextFocusableComponent(this);
5822             }
5823         }
5824         return comp;
5825     }
5826 
5827     /**
5828      * Discards the editor object and frees the real estate it used for
5829      * cell rendering.
5830      */
5831     public void removeEditor() {
5832         KeyboardFocusManager.getCurrentKeyboardFocusManager().


8771                 AccessibleContext ac = getCurrentAccessibleContext();
8772                 if (ac instanceof AccessibleComponent) {
8773                     ((AccessibleComponent) ac).setSize(d);
8774                 } else {
8775                     Component c = getCurrentComponent();
8776                     if (c != null) {
8777                         c.setSize(d);
8778                     }
8779                 }
8780             }
8781 
8782             public Accessible getAccessibleAt(Point p) {
8783                 AccessibleContext ac = getCurrentAccessibleContext();
8784                 if (ac instanceof AccessibleComponent) {
8785                     return ((AccessibleComponent) ac).getAccessibleAt(p);
8786                 } else {
8787                     return null;
8788                 }
8789             }
8790 

8791             public boolean isFocusTraversable() {
8792                 AccessibleContext ac = getCurrentAccessibleContext();
8793                 if (ac instanceof AccessibleComponent) {
8794                     return ((AccessibleComponent) ac).isFocusTraversable();
8795                 } else {
8796                     Component c = getCurrentComponent();
8797                     if (c != null) {
8798                         return c.isFocusTraversable();
8799                     } else {
8800                         return false;
8801                     }
8802                 }
8803             }
8804 
8805             public void requestFocus() {
8806                 AccessibleContext ac = getCurrentAccessibleContext();
8807                 if (ac instanceof AccessibleComponent) {
8808                     ((AccessibleComponent) ac).requestFocus();
8809                 } else {
8810                     Component c = getCurrentComponent();


9623             public Accessible getAccessibleAt(Point p) {
9624                 AccessibleContext ac = getCurrentAccessibleContext();
9625                 if (ac instanceof AccessibleComponent) {
9626                     return ((AccessibleComponent) ac).getAccessibleAt(p);
9627                 } else {
9628                     return null;
9629                 }
9630             }
9631 
9632             /**
9633              * Returns whether this object can accept focus or not.   Objects that
9634              * can accept focus will also have the AccessibleState.FOCUSABLE state
9635              * set in their AccessibleStateSets.
9636              *
9637              * @return true if object can accept focus; otherwise false
9638              * @see AccessibleContext#getAccessibleStateSet
9639              * @see AccessibleState#FOCUSABLE
9640              * @see AccessibleState#FOCUSED
9641              * @see AccessibleStateSet
9642              */

9643             public boolean isFocusTraversable() {
9644                 AccessibleContext ac = getCurrentAccessibleContext();
9645                 if (ac instanceof AccessibleComponent) {
9646                     return ((AccessibleComponent) ac).isFocusTraversable();
9647                 } else {
9648                     Component c = getCurrentComponent();
9649                     if (c != null) {
9650                         return c.isFocusTraversable();
9651                     } else {
9652                         return false;
9653                     }
9654                 }
9655             }
9656 
9657             /**
9658              * Requests focus for this object.  If this object cannot accept focus,
9659              * nothing will happen.  Otherwise, the object will attempt to take
9660              * focus.
9661              * @see #isFocusTraversable
9662              */




5793         return editor;
5794     }
5795 
5796 
5797     /**
5798      * Prepares the editor by querying the data model for the value and
5799      * selection state of the cell at <code>row</code>, <code>column</code>.
5800      * <p>
5801      * <b>Note:</b>
5802      * Throughout the table package, the internal implementations always
5803      * use this method to prepare editors so that this default behavior
5804      * can be safely overridden by a subclass.
5805      *
5806      * @param editor  the <code>TableCellEditor</code> to set up
5807      * @param row     the row of the cell to edit,
5808      *                where 0 is the first row
5809      * @param column  the column of the cell to edit,
5810      *                where 0 is the first column
5811      * @return the <code>Component</code> being edited
5812      */
5813     @SuppressWarnings("deprecation")
5814     public Component prepareEditor(TableCellEditor editor, int row, int column) {
5815         Object value = getValueAt(row, column);
5816         boolean isSelected = isCellSelected(row, column);
5817         Component comp = editor.getTableCellEditorComponent(this, value, isSelected,
5818                                                   row, column);
5819         if (comp instanceof JComponent) {
5820             JComponent jComp = (JComponent)comp;
5821             if (jComp.getNextFocusableComponent() == null) {
5822                 jComp.setNextFocusableComponent(this);
5823             }
5824         }
5825         return comp;
5826     }
5827 
5828     /**
5829      * Discards the editor object and frees the real estate it used for
5830      * cell rendering.
5831      */
5832     public void removeEditor() {
5833         KeyboardFocusManager.getCurrentKeyboardFocusManager().


8772                 AccessibleContext ac = getCurrentAccessibleContext();
8773                 if (ac instanceof AccessibleComponent) {
8774                     ((AccessibleComponent) ac).setSize(d);
8775                 } else {
8776                     Component c = getCurrentComponent();
8777                     if (c != null) {
8778                         c.setSize(d);
8779                     }
8780                 }
8781             }
8782 
8783             public Accessible getAccessibleAt(Point p) {
8784                 AccessibleContext ac = getCurrentAccessibleContext();
8785                 if (ac instanceof AccessibleComponent) {
8786                     return ((AccessibleComponent) ac).getAccessibleAt(p);
8787                 } else {
8788                     return null;
8789                 }
8790             }
8791 
8792             @SuppressWarnings("deprecation")
8793             public boolean isFocusTraversable() {
8794                 AccessibleContext ac = getCurrentAccessibleContext();
8795                 if (ac instanceof AccessibleComponent) {
8796                     return ((AccessibleComponent) ac).isFocusTraversable();
8797                 } else {
8798                     Component c = getCurrentComponent();
8799                     if (c != null) {
8800                         return c.isFocusTraversable();
8801                     } else {
8802                         return false;
8803                     }
8804                 }
8805             }
8806 
8807             public void requestFocus() {
8808                 AccessibleContext ac = getCurrentAccessibleContext();
8809                 if (ac instanceof AccessibleComponent) {
8810                     ((AccessibleComponent) ac).requestFocus();
8811                 } else {
8812                     Component c = getCurrentComponent();


9625             public Accessible getAccessibleAt(Point p) {
9626                 AccessibleContext ac = getCurrentAccessibleContext();
9627                 if (ac instanceof AccessibleComponent) {
9628                     return ((AccessibleComponent) ac).getAccessibleAt(p);
9629                 } else {
9630                     return null;
9631                 }
9632             }
9633 
9634             /**
9635              * Returns whether this object can accept focus or not.   Objects that
9636              * can accept focus will also have the AccessibleState.FOCUSABLE state
9637              * set in their AccessibleStateSets.
9638              *
9639              * @return true if object can accept focus; otherwise false
9640              * @see AccessibleContext#getAccessibleStateSet
9641              * @see AccessibleState#FOCUSABLE
9642              * @see AccessibleState#FOCUSED
9643              * @see AccessibleStateSet
9644              */
9645             @SuppressWarnings("deprecation")
9646             public boolean isFocusTraversable() {
9647                 AccessibleContext ac = getCurrentAccessibleContext();
9648                 if (ac instanceof AccessibleComponent) {
9649                     return ((AccessibleComponent) ac).isFocusTraversable();
9650                 } else {
9651                     Component c = getCurrentComponent();
9652                     if (c != null) {
9653                         return c.isFocusTraversable();
9654                     } else {
9655                         return false;
9656                     }
9657                 }
9658             }
9659 
9660             /**
9661              * Requests focus for this object.  If this object cannot accept focus,
9662              * nothing will happen.  Otherwise, the object will attempt to take
9663              * focus.
9664              * @see #isFocusTraversable
9665              */


< prev index next >