<Swing Dev> [9] Review request for 8008657 JSpinner setComponentOrientation doesn't affect on text orientation

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Feb 14 15:53:21 UTC 2014


Hi, Alexander.
The fix looks good. But can you please add a comment to the constructor 
of NumberEditor... where we set default alignment of text component to 
JTextField.RIGHT.

On 2/14/14 2:50 PM, Alexander Scherbatiy wrote:
>
>   Hello,
>
>   Could you review the fix?
>
>  Thanks,
>  Alexandr.
>
> On 1/24/2014 2:14 PM, Alexander Scherbatiy wrote:
>>
>>   Could you review the updated fix:
>>     http://cr.openjdk.java.net/~alexsch/8008657/webrev.02/
>>
>>    The applyComponentOrientation() method is only invoked for the 
>> spinner editor.
>>
>> On 1/24/2014 2:21 AM, Sergey Bylokhov wrote:
>>> Hi, Alexander.
>>> Why the change in the BasicSpinnerUI is required? Can we call a 
>>> revalidate/repaint in the JSpinner.setComponentOrientation()?
>>     All of the wing classes use the revalidate/repaint for the 
>> "componentOrientation" event in L&Fs.
>>     Using it in JSpinner.setComponentOrientation() makes a mess in 
>> the "componentOrientation" event handling.
>>     I think that  we should use the unified way in this case.
>>
>>     If using revalidate/repaint in L&F for property updating is 
>> totally wrong (which is used a lot, see redrawList() for BasicListUI 
>> or modelChanged() for BasicTextUI and others)
>>     then it is better to file a new issue about events handling 
>> refactoring in Swing classes/L&Fs
>>
>>> Note that JSpinner is a JComponent which is Container, so when you 
>>> call applyComponentOrientation on it you apply new orientation to 
>>> the whole JSpinner hierarchy, and it looks wrong.(I know that it is 
>>> unlikely).
>>      The only way it can be done in this case is invoking the 
>> applyComponentOrientation() for the spinner editor.
>>      The editor can be any JComponent. We can go further and check if 
>> the editor is the DefaultEditor and set the component orientation 
>> only for the editor text field.
>>      However, it seems possible that a user can add some other 
>> components to the DefaultEditor.
>>
>>   Thanks,
>>   Alexandr.
>>>
>>> On 23.01.2014 19:06, Alexander Scherbatiy wrote:
>>>>
>>>>
>>>> Could you review the updated fix:
>>>>   http://cr.openjdk.java.net/~alexsch/8008657/webrev.01
>>>>
>>>>   - revalidate()/repaint() is added after component orientation 
>>>> applying in the same way as it is done for the JTextFiled
>>>>   - there is one more issue that a text in the Number editor should 
>>>> stick to the arrows. It is fixed in the NumberEditor class.
>>>>
>>>>  Thanks,
>>>>  Alexandr.
>>>>
>>>> On 1/22/2014 6:00 PM, Sergey Bylokhov wrote:
>>>>> Hello, Alexander.
>>>>> Is updateUI needed to fix the problem? Since 
>>>>> applyComponentOrientation calls invalidateIfValid  anyway.
>>>>>
>>>>> On 20.01.2014 17:50, Alexander Scherbatiy wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Could you review the fix:
>>>>>>   bug: https://bugs.openjdk.java.net/browse/JDK-8008657
>>>>>>   webrev: http://cr.openjdk.java.net/~alexsch/8008657/webrev.00
>>>>>>
>>>>>>  The "componentOrientation" property change event should be 
>>>>>> propagated to the JSpinner editor component.
>>>>>>
>>>>>> Thanks,
>>>>>> Alexandr.
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>


-- 
Best regards, Sergey.




More information about the swing-dev mailing list