Scala Swing Component Calibration

Scala is an amazing language, but unfortunately there is no library documentation. How to change the initial size of a component? I have nothing (intentionally), but I would like it to be a certain size. I currently have

... contents = new BoxPanel(Orientation.Vertical) { contents += new BoxPanel(Orientation.Horizontal) { contents += buttons(0) contents += buttons(1) contents += buttons(2) } contents += new BoxPanel(Orientation.Horizontal) { contents += buttons(3) contents += buttons(4) contents += buttons(5) } contents += new BoxPanel(Orientation.Horizontal) { contents += buttons(6) contents += buttons(7) contents += buttons(8) } border = Swing.EmptyBorder(10, 10, 10, 10); } ... 

buttons is an array from scala.swing.Button s. Unfortunately, they are all very small when the application starts. I would like them to be about 60x60 pixels each, although a reasonably large square is enough.

+4
source share
1 answer

Have you tried setting your preferred button size?

 buttons foreach { _.preferredSize = new Dimension(60, 60) } 
+3
source

All Articles