Closed Mazi-S closed 1 week ago
I suggest making this configurable through an overload of the UI.scrollPane()
factory method, which currently does not have any other overloads and offers
itself very well for this sort of config...
This would also make it consistent with other factory methods, ike
for example the UI.table(Configurator)
method where you can build the
table model using the configurator lambda.
So I I'd imagine this to look like this:
.add(GROW,
scrollPane( conf -> conf
.prefSize( it -> it.component().getPreferredSize() )
.scrollIncrement( it -> 42 )
.fitWidth( it -> true )
.fitHeight( it -> false )
)
)
...where it
is a delegate object for the Scrollable
component
(we could call it ScrollableComponentDelegate
)
as well as some useful context information like for example:
I did a proof of concelt implementation of this. Since you have alreay worked with
the Scrollable
interface and how it works, can you check out the implementation and
check if it has the expected behaviour?
Currently, if the content of a
scrollPane' implements the
Scrollable' interface and you change the behavior of how the content is scrolled, the changed behavior is applied only if no add config was specified when the content was added:The specified behavior is applied.
The specified behavior is NOT applied.
I think it would be nice to allow both (
AddConstraint
and define how the content should be scrolled).The following would be a good approach, and would also eliminate the need to implement the `Scrollable' interface every time you want to define the behavior.