I am using GroupLayout
for my main layout, and baseline alignment works fine, until I add internal panels. It seems the baseline is not propagated through these panels: While all buttons, labels, etc. directly added to the panel with GroupLayout
are properly aligned with respect to their baseline, the components inside the inner panels are not.
Since Scala Swing surprisingly doesn't have a GroupPanel
, I am using the one from Andreas Flierl, but that shouldn't be important, as I am sure it's an issue of the underlying swing classes and how to condition them.
import swing._
import eu.flierl.grouppanel.GroupPanel
val f = new Frame {
contents = new GroupPanel {
val but = new Button { text = "button" }
val lb = new Label { text = "label" }
val inner = new FlowPanel {
contents += new Button { text = "ibut" }
contents += new Label { text = "ilab" }
}
theHorizontalLayout is Sequential (but, lb, inner)
theVerticalLayout is Parallel(Baseline)(but, lb, inner)
}
centerOnScreen()
pack()
open()
}
Note in the screenshot, how the inner panel is aligned with the bottom and not baseline. This problem is independent of the layout manager used for the child panel (it could be another group layout).