You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constraints should be a member of the companion object rather than the class, as there's no reason to tie constraint construction to a particular panel instance.
The add method should not be protected. That may have made sense if GridBagPanel is to be used only declaratively, but arguably this layout is too complex for that. Rather, it's a prime candidate for wrapping by some application-specific declarative framework, in which case the protection is just a pain.
The single mutating constraints object as used in the demo code is nasty. Ideally Constraints should be a case class with keyword arguments.
The text was updated successfully, but these errors were encountered:
Suggested changes:
Constraints
should be a member of the companion object rather than the class, as there's no reason to tie constraint construction to a particular panel instance.The
add
method should not be protected. That may have made sense ifGridBagPanel
is to be used only declaratively, but arguably this layout is too complex for that. Rather, it's a prime candidate for wrapping by some application-specific declarative framework, in which case the protection is just a pain.The single mutating constraints object as used in the demo code is nasty. Ideally
Constraints
should be a case class with keyword arguments.The text was updated successfully, but these errors were encountered: