RFR: 6510914: JScrollBar.getMinimumSize() breaks the contract of JComponent.setMinimumSize() [v6]

Alexey Ivanov aivanov at openjdk.org
Fri Nov 10 11:35:08 UTC 2023


On Mon, 6 Nov 2023 06:22:33 GMT, Prasanta Sadhukhan <psadhukhan at 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

> > Otherwise, the contract of `set{Min,Max}Size` will still be broken
> 
> That's what we are trying to clarify in the JScrollBar spec that the contract specified in JComponent is not valid for this widget because of so and so reason, right?

Exactly! And it is the `set-` functions that need to change.

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

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


More information about the client-libs-dev mailing list