On Mon, 6 Nov 2023 06:22:33 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> javadoc contract for JComponent.setMinimumSize(Dimension) states:
>> 
>> "Sets the minimum size of this component to a constant value. Subsequent 
>> calls to getMinimumSize will always return this value..."
>> 
>> However, JScrollBar overrides getMinimumSize() and breaks this contract - it 
>> always returns a minimum size derived from the preferred size even if you 
>> have previously called setMinimumSize()
>> 
>> Fix is made to check if mnimumSize is set and if so, honour it..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Reinstate setEnabled

Although there seems to be no difference in rendering the scrollbars with and 
without these getXXX methods as can be seen here (top one without, bottom one 
with the methods), 

![image](https://github.com/openjdk/jdk/assets/43534309/2ef18f78-7207-4ceb-b128-5ab77d771950)

I could see difference in behaviour when the frame is resized
and since the premise of the fix is there should not be any difference in 
behaviour if these methods are removed, I agree that removing the methods as is 
done in this PR may not be appropriate
but I also think adding setXXX methods in JScrollBar class just to clarify 
existing spec may also not be appropriate.
In this light, can we consider the previous iteration of the [spec 
clarification](https://openjdk.github.io/cr/?repo=jdk&pr=15325&range=03#sdiff-0-src/java.desktop/share/classes/javax/swing/JScrollBar.java)
 

@prrace @aivanov-jdk please provide your thoughts..

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

PR Comment: https://git.openjdk.org/jdk/pull/15325#issuecomment-1801092478

Reply via email to