RFR: 6465404: some problems in CellEditor related API docs

Alexey Ivanov aivanov at openjdk.java.net
Mon Dec 6 19:03:17 UTC 2021


On Mon, 6 Dec 2021 17:21:34 GMT, Phil Race <prr at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/table/TableCellEditor.java line 35:
>> 
>>> 33:  * This interface defines the method any object that would like to be
>>> 34:  * an editor of values for the component <code>JTable</code> that
>>> 35:  * needs to implement.
>> 
>> Suggestion:
>> 
>>  * an editor of values for the {@code JTable} component needs to implement.
>> 
>> _‘that’_ after `JTable` shouldn't be there.
>> 
>> However, I would suggest rephrasing the Javadoc to make it easier to understand: the sentence has two levels of dependent clauses.
>
> I'm not sure this fix is going in the right direction. Isn't the doc saying that if you want to use one of these components as the cell of a JTable it should implement this interface ?
> And the problem with JListBox is that it is actually just called JList ?

As I read it, the interface `TableCellEditor` adds the `getTableCellEditorComponent` method to the generic `CellEditor` interface.

There's also `TreeCellEditor` interface which adds `getTreeCellEditorComponent` specifically for `JTree`. This one has a cleaner [Javadoc](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/tree/TreeCellEditor.html):

> Adds to CellEditor the extensions necessary to configure an editor in a tree.

The `TableCellEditor` interface should say something similar.

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

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



More information about the client-libs-dev mailing list