绝对布局的替代方案? [英] Alternative to absolute layout?
问题描述
是否有一个布局管理器提供与 <相同程度的控制em>绝对定位 ?
但是还可以自动调整大小吗?你可以使用相对坐标放置元素的东西吗?
Is there a layout manager that gives the same degree of control as Absolute Positioning? But also makes auto resizing possible? Something where you could place elements using relative coordinates?
推荐答案
JDK中最强大的布局管理器是 GridBagLayout
。然而,典型的UI包含面板的组合,每个面板被配置为使用不同的布局。例如整个窗口的边框布局,包含一组按钮的面板的流布局, GridLayout
或 GridBagLayout
复杂部分。
The most powerful layout manager in JDK is GridBagLayout
. However typical UI contains composition of panels each of them is configured to use different layout. For example border layout for whole window, flow layout for panel that contains a set of buttons, GridLayout
or GridBagLayout
for complex parts.
您还可以查看 MigLayout <等替代方案。 / a> - 非常强大的工具,可以创建几乎任何你能想象到的视图。
You can also take a look on alternatives like MigLayout - very powerful tool that allows creating almost any view you can imagine.
这篇关于绝对布局的替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!