gpt4 book ai didi

Java 布局管理器

转载 作者:搜寻专家 更新时间:2023-11-01 04:02:10 25 4
gpt4 key购买 nike

我使用 2 行 6 列的网格布局。第一列是标签,第二列是组合。我的问题是

according to the size of the label the combo box size also increases. i want a stable size for combo? which layout should i use? I want a design like

*标签 1:组合 1 标签 2:组合 2 标签 3:组合 3 label4: text1 label5: text2 label6: text3 *

最佳答案

  1. 对于 GridLayout,您可以使用 JComboBox#setPrototypeDisplayValue , 然后你就可以很方便的在屏幕上设置JComboBox的初始大小

  2. 您可以使用 SpringLayoutGridBagLayout

  3. 使用今天的自定义 LayoutManagers 作为 MigLayout 的例子

  4. 注意选择合适的 LayoutManager,一切都取决于内容是否应该随容器调整大小

关于Java 布局管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11773447/

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