Java 如何使用 MigLayout?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/352781/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 13:44:09  来源:igfitidea点击:

How to use MigLayout?

javamiglayoutlayout-manager

提问by guerda

I read some information about Java layout managers and the recommendation was MigLayout. My problem is, that I didn't found any tutorial or easy step-by-step documentation.

我阅读了一些关于 Java 布局管理器的信息,推荐的是MigLayout。我的问题是,我没有找到任何教程或简单的分步文档。

So I want to know how this all works, but I don't know how.

所以我想知道这一切是如何运作的,但我不知道如何运作。

Hope, it's not to trivial.

希望,这不是微不足道的。

Thanks in advance, guerda

提前致谢,古尔达

回答by PhiLho

Bombe is right... and wrong. I find this whitepaper tends to show off all great features of MiGLayout, entering in nitty gritty details that we would rarely, if ever, use... The paper hesitates between being a tutorial and a reference.

邦贝是对的……也是错的。我发现这份白皮书倾向于展示 MiGLayout 的所有强大功能,并详细介绍我们很少(如果有的话)使用的细节……本文在作为教程和参考之间犹豫不决。

Now, the provided demo applications (at MiG Layout main pageand MiG Java Components page) are very well made: you can see the components and how they move/are resized, and you can take a look at the source code used to do this layout, which is a precious source of concrete implementation. Precious because I haven't found many open source projects actually using this layout (perhaps I just wasn't searching properly).

现在,提供的演示应用程序(在MiG Layout 主页MiG Java Components 页面)制作得非常好:您可以看到组件以及它们如何移动/调整大小,您可以查看用于执行此操作的源代码布局,这是具体实施的宝贵资源。很宝贵,因为我还没有发现很多开源项目实际使用这种布局(也许我只是没有正确搜索)。

回答by Alex B

The people at MigLayout have setup a great demo that lets you learn how to configure the miglayout through experimentation.

MigLayout 的人设置了一个很棒的演示,让您可以通过实验了解如何配置 miglayout。

Go to http://www.miglayout.com/and select Swing Demo. You can then see sample uses of the layout and more importantly, you can right-click on any component (textfield, label, etc.) and change the layout constraints. This is an excellent interactive tool to learn about the layout and how it will work with resizing, etc.

转至http://www.miglayout.com/并选择Swing Demo。然后您可以查看布局的示例使用,更重要的是,您可以右键单击任何组件(文本字段、标签等)并更改布局约束。这是一个出色的交互式工具,可用于了解布局以及如何调整大小等。

回答by Abhinav Upadhyay

Maybe its too late. But I found this helpful article on MigLayout: (the original link seems to be offline now, so the only way to access it is archive.org)

也许为时已晚。但是我在 MigLayout 上找到了这篇有用的文章:(原始链接现在似乎处于离线状态,因此访问它的唯一方法是 archive.org)

The valid link, if the first one's broken, is here.
And now there is a websiteavailable.

有效链接,如果第一个坏了,就在这里
现在有一个网站可用。

回答by Peter Tseng

WindowBuildersuports MigLayout, if you want to jump in right away, and look up the docs as needed.

WindowBuilder支持 MigLayout,如果您想立即加入,并根据需要查找文档。

However, the docs and demos from the websiteare simple enough that it doesn't take much time to read through them.

但是,该网站上的文档和演示非常简单,通读它们并不需要太多时间。

回答by Sikander Nawaz

Any one who came here now can download miglayout-4.0-swt.jar (any version not 4.0 only ) from here

现在来到这里的任何人都可以从这里下载 miglayout-4.0-swt.jar(任何版本不是 4.0)

http://www.migcalendar.com/miglayout/versions/4.0/

http://www.migcalendar.com/miglayout/versions/4.0/

and see videoTutoial to add them to jar files

并观看视频教程将它们添加到 jar 文件中

http://www.youtube.com/watch?v=XAtKb-KaC7o

http://www.youtube.com/watch?v=XAtKb-KaC7o

回答by KathyA.

Another help for those coming here now...

对那些现在来到这里的人的另一个帮助......

I find the Quick Startfor MigLayout to be a good place to start, especially when I haven't used it for a while and need to get back up to speed.

我发现MigLayout的快速入门是一个很好的起点,尤其是当我有一段时间没有使用它并且需要恢复速度时。