On Thu, 16 Dec 2021 05:18:04 GMT, Sergey Bylokhov <[email protected]> wrote:
>> 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. > >> 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. > > My thoughts about this. The object which implements the interface is always > the "editor", even if it is not a component. I guess you are mixing it with > the other classes like "JEditorPane/JTextField/etc". > > The current spec: > >>This interface defines the method any object that would like to be > an editor of values for components such as <code>JListBox</code>, > <code>JComboBox</code>, <code>JTree</code>, or <code>JTable</code> > needs to implement. > > This means that the application may have some values/data stored in the > JComboBox/JTree/JTable and the application may create a cell editor by > implementing the TableCellEditor. That editor then could be used as a cell > editor in the "main" JTable. > > So the next statement in the description of this PR is not completely right: >> "CellTableEditor Interface doesn't support JComboBox and JTree components" > > The JComboBox and other classes do not have to implement/support that > interface. Yeah, if u refer this example page [https://bip.weizmann.ac.il/course/prog2/tutorial/uiswing/components/example-1dot4/ColorEditor.java], the interface is used for a cell in a table which has a button in turn invokes "JColorChooser" class. Which means the interface is used to store a particular value while the cell in is editor mode......? ------------- PR: https://git.openjdk.java.net/jdk/pull/6608
