Open
Description
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.