<Swing Dev> [9] Review Request: JDK-8032878: Editable combos in table do not behave as expected

Alexey Ivanov alexey.ivanov at oracle.com
Thu Mar 20 06:18:40 UTC 2014


Reminder.

Could you please review the fix for jdk9:
   bug: https://bugs.openjdk.java.net/browse/JDK-8032878
   webrev: http://cr.openjdk.java.net/~dmarkov/8032878/jdk9/webrev.01/


Thank you,
Alexey.


On 17.03.2014 18:12, Alexander Scherbatiy wrote:
>
>   The fix looks good for me.
>
> On 3/17/2014 5:32 PM, Alexey Ivanov wrote:
>> Hi Alexandr,
>>
>> I've corrected the condition, please find the updated webrev at
>> http://cr.openjdk.java.net/~dmarkov/8032878/jdk9/webrev.01/ 
>> <http://cr.openjdk.java.net/%7Edmarkov/8032878/jdk9/webrev.01/>
>>
>>
>> - You're right! The correct condition must have been
>> !Boolean.TRUE.equals(getClientProperty("JComboBox.isTableCellEditor"))
>>
>> - It's expected. JTable has two cell editing modes:
>>   * if surrendersFocusOnKeystroke is false (the default), then the table
>>     owns the input focus, and "forwards" keys to the editor. Arrow keys
>>     will move selection to another cell in this case.
>>   * if surrendersFocusOnKeystroke is true, the cell editor will be the
>>     focus owner and therefore arrow keys could be used for moving
>>     cursor inside the edited text as well as selecting text.
>>
>> So to fix the issue with arrow keys, the default value of 
>> JTable.surrendersFocusOnKeystroke has to be changed to true. It may 
>> break some applications.
>> As far as I understand, the current behavior is similar to 
>> spreadsheet applications where arrow keys move selection to another 
>> cell unless you press F2 or double-click to start cell editing.
>>
>> I think it's safer to preserve the current behavior with regards to 
>> arrow keys. What do you think?
>>
>        I see. Yes, it is better to leave it as is.
>
>   Thanks,
>   Alexandr.
>
>>
>> Thanks,
>> Alexey.
>>
>> On 17.03.2014 15:48, Alexander Scherbatiy wrote:
>>>
>>>
>>>   - It seems that the "JComboBox.isTableCellEditor" client property 
>>> can have null value which should be treated as false
>>>     but it does not pass the check Boolean.FALSE.equals(null).
>>>  - I am not able to use  arrows during JComboBox editing because it 
>>> moves the focus to another component.
>>>    The same is for table cells which use TextComponent. May be it 
>>> have sense to create a separate issue that it should be
>>>     possible to use arrows in the component during editing.
>>>
>>>   Otherwise the fix looks good for me.
>>>
>>>   Thanks,
>>>   Alexandr.
>>>
>>>
>>> On 3/14/2014 3:23 PM, Alexey Ivanov wrote:
>>>> Hello,
>>>>
>>>> Could you please review the fix for jdk9:
>>>>   bug: https://bugs.openjdk.java.net/browse/JDK-8032878
>>>>   webrev: http://cr.openjdk.java.net/~dmarkov/8032878/jdk9/webrev.00/
>>>>
>>>> Problem description:
>>>> If editable JComboBox is used as cell editor in JTable, its value 
>>>> does not change when user types keys.
>>>>
>>>> If JTable.setSurrendersFocusOnKeystroke(true) is in effect, then 
>>>> JComboBox (usually) loses the first key press before it gets the 
>>>> input focus.
>>>>
>>>>
>>>> Fix:
>>>> If JComboBox is table cell editor and is editable, it will forward 
>>>> TextActions to its editor component. The action binding is obtained 
>>>> from InputMap of the editor component with WHEN_FOCUSED condition, 
>>>> as if the editor had focus.
>>>>
>>>>
>>>> Thanks,
>>>> Alexey.
>>>
>>
>




More information about the swing-dev mailing list