您推荐哪种 Swing 布局? [英] Which Swing layout(s) do you recommend?

查看:42
本文介绍了您推荐哪种 Swing 布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅 Java 库中就有 8 个布局管理器,然后还有一堆 3rd 方产品.

There are 8 layout managers in the Java library alone, and then there's a bunch of 3rd party products as well.

前几天,我尝试使用 SpringLayout 并且......好吧,它对我不起作用.请参阅我的其他问题.所以...如果您有一个 Swing 应用程序要设计,并且您希望您的布局恰到好处,那么您首选的布局管理器是什么?有什么有趣/有用的经历可以联系起来?

The other day, I tried to use SpringLayout and... well, it ain't working out for me. See my other question. So... if you have a Swing app to design, and you want your layout just so, what are your preferred layout managers? Any interesting/useful experiences to relate?

更新: 是的,我知道不同的 LM 适用于不同的布局.但我希望你们中的大多数人在所做的大多数事情中都使用 1、2 或 3,或者您发誓使用一个如此多才多艺的人,您永远不需要其他任何东西.有了足够的响应,我希望看到类似钟形曲线的东西,在 GridBagLayout 或 MigLayout(例如)上有一个峰值,以及一些使用(比如)BoxLayout 或 FlowLayout 的落后者的长尾.

Update: Yup, sure I'm aware that different LMs are appropriate for different layouts. But I'd expect that most of you use 1, 2 or maybe 3 for most everything you do, or you swear by a single one that's so versatile you never need anything else. With enough responses, I'd expect to see something like a bell curve, with a peak on GridBagLayout or MigLayout (for example) and a long tail of a few stragglers using (say) BoxLayout or FlowLayout.

希望回复的分布能够揭示人们最常使用什么来完成工作

Hopefully, the distribution of responses will reveal some trends as to what people use most to Get Stuff Done

好吧,差不多2天后,MiGLayout绝对领先!它的粉丝会很高兴听到这个布局看起来很快就会进入官方"库.

OK, after almost 2 days, MiGLayout is definitely out in front! Its fans will be happy to hear that it looks like this layout will be entering the "official" library soon.

GroupLayout、FormsLayout 和 TableLayout 相对较新,并没有得到太多曝光.也许其他人会和我一样惊讶地发现他们.

GroupLayout, FormsLayout and TableLayout are relatively new and haven't gotten much exposure. Perhaps others will be as surprised to find out about them as I was.

推荐答案

MiGLayout,毫无疑问.老实说,这是我所知道的唯一一个有意义的 Swing 布局管理器.

MiGLayout, no doubt. Honestly, it's the only Swing layout manager I know of that makes any sense.

核心 JDK 中有 8 个布局管理器这一事实表明,Swing 创建者完全不知道他们要做什么.这并不是要破坏 Swing 的其余部分 - 除了布局管理器之外,它是一个很好的 GUI 工具包.

The mere fact that there are 8 layout managers in the core JDK is a good sign that the Swing creators had absolutely no idea about what they were trying to do. This is not to trash the rest of the Swing - it's a good GUI toolkit, except for the layout managers.

这篇关于您推荐哪种 Swing 布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆