gpt4 book ai didi

swing - Scala Swing 组件大小调整

转载 作者:行者123 更新时间:2023-12-01 02:53:24 31 4
gpt4 key购买 nike

Scala 是一种很棒的语言,但不幸的是缺少库文档。如何更改组件的初始大小?我什么都没有(故意),但无论如何都希望它是一定的。我目前有

...
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);
}
...
buttonsscala.swing.Button 的数组s。不幸的是,当应用程序运行时,它们都显得很小。我希望它们每个大约为 60x60 像素,尽管任何相当大的正方形就足够了。

最佳答案

您是否尝试过在按钮上设置首选大小?

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

关于swing - Scala Swing 组件大小调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4000992/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com