On Wed, 15 Dec 2021 01:36:38 GMT, Sergey Bylokhov <[email protected]> wrote:

>> @prrace Shall we update `TableCellEditor` Javadoc to _“Adds to CellEditor 
>> the extensions necessary to configure an editor in a table.”_ to make it 
>> similar to `TreeCellEditor`?
>
> Isn't this is another way around? The doc says that the object implementing 
> this interface can be used "as an editor of values for components such as 
> XXX", and it does not say that the XXX class should support the 
> CellTableEditor? 
> For example, the DefaultCellEditor class can be used as an editor for 
> JComboBox/JCheckBox/JTextField.

Hm… It's not the other way around. `DefaultCellEditor` implements 
`TableCellEditor`; the interface defines the `getTableCellEditorComponent` 
method that returns the _real component_ which will be used as the value editor.

So yeah, you're absolutely right: the current statement in the doc seems wrong.

I'm for changing the Javadoc for `TableCellEditor` to be similar to 
`TreeCellEditor`: _“Adds to CellEditor the extensions necessary to configure an 
editor in a table.”_

The object that implements the interface is not necessarily the editor for 
values. `DefaultCellEditor`  is the perfect example: it's not an editor itself, 
it's not even a component, all it does is configures a delegate, a 
`JComponent`, which serves as the editor.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6608

Reply via email to