用Java构建GUI [英] Building a GUI in Java

查看:156
本文介绍了用Java构建GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您更喜欢使用什么机制构建GUI:从头开始或使用GUI构建软件?

What mechanism do you prefer for building a GUI: from scratch or using GUI-building software?

推荐答案

我其实很喜欢使用NetBeans GUI Builder构建GUI;事情是,它是相当可定制的 - 它允许您更改用于自动生成的代码和自动生成的代码[没有双关语意图](这是自定义组件所必需的),它还允许简单的事件处理和约束力。 NetBeans GUI Builder不仅限于GroupLayout,而是允许您选择使用哪个LayoutManager(在表单的属性对话框中有一些隐藏的设置)。

I actually enjoy building GUIs with the NetBeans GUI Builder; the thing is, it is fairly customizable - it allows you to change the code used for auto-generation and the auto-generated code [no pun intended] (which is necessary for custom components), it also allows "easy" event-handling and binding. And NetBeans GUI Builder is not restricted to GroupLayout but rather allows you to choose which LayoutManager to use (a somewhat hidden setting in the form's properties dialog).

但它不是永远是最好的选择;正如其他人已经说过的那样:当你需要完全控制你的应用程序,了解每一个JLabel,每个JButton等时,MiG Layout是一个不错的选择。

But it is not always the best choice; as others already said: MiG Layout is a good choice when you need to have full control of your application, knowing every single JLabel, every JButton etc.

我必须承认我更喜欢Netbeans的GUI构建器,以便于使用和WYSIWYG视图。
但我也认为,如果您手动或使用GUI-Designer创建GUI代码,则无关紧要;添加控件/自定义组件动态地适用于两者,执行此操作并且适用于两者等。唯一重要的是它可以工作。

I must confess I prefer Netbeans' GUI builder for the ease of use and WYSIWYG view. But I also think that it does not even matter if you have created the GUI-Code by hand or with a GUI-Designer; adding Controls / custom Components dynamically works with both, doing this and that works with both etc.. The only thing that matters is that it works.

(从我的观点来看如果使用GUI-Builder可以更快地完成GUI,那么我没有看到手动编码GUI的重点,因为我不明白为什么人们应该在没有某种好处的情况下手动编码它。

(From my point of view I do not see a point in coding a GUI manually if it can be done faster with a GUI-Builder, as I do not see why one should bother coding it by hand without some kind of benefit)

这篇关于用Java构建GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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