Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我从文档中不清楚 - 当我指出单元格宽度时
panel.add(cc,"width 100:200:300");
我是要求单元格或单元格中的组件的最小:首选项:最大宽度吗?
根据我的经验,最好在布局级别强制执行这种约束,这样可以实现更一致的行为。
例如,
new MigLayout("insets 0", "[:50:][grow,fill,:50:250]20[:50:][grow,fill,:50:]", "[c]")`
其中第二个参数设置列的布局属性(在这种情况下为四列,具有特定的首选宽度和最大宽度)。然后使用这个布局管理器将组件添加到容器中,只需调用
panel.add(cc);
带或不带“wrap”选项(表示需要创建新行)。