使用Java Swing和Netbeans IDE创建GUI [英] Creating GUI's using Java Swing with Netbeans IDE

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

问题描述

他们具有非常酷的拖放功能,可以动态创建GUI.但是我无法从这种方法中学到任何东西,对此我感到内gui.大多数Java程序员都使用这种方法吗?因为实现了它生成的代码,所以用IMO手动编写GUI是不切实际的.

They have this very cool drag and drop thing that creates GUI on the fly. But I don't get to learn anything out from this method and I feel guilty about it. Do most of the Java programmers use this method? Because realizing the code it generates, it's quite impractical coding the GUI by hand IMO.

推荐答案

使用GUI生成器没有任何问题,只要您了解该工具的功能以及使用所选工具的含义即可.

There's nothing wrong with using a GUI builder, as long as you understand what the tool is doing and the implications of using the tool of choice.

您需要知道的第一件事是该工具在做什么.在这种情况下,您应该了解Java Swing和主题,例如布局管理器,组件,使用Swing时出现的并发问题(即使使用工具也很方便),事件侦听器和处理程序.确实,您应该能够通过一个简单的教程,例如

The first thing you need to know is what the tool is doing. In this case, you should understand Java Swing and topics such as layout managers, components, concurrency issues that arise when using Swing (this will be handy even when using a tool), event listeners and handlers. Really, you should be able to walk through a simple tutorial, such as this one on Creating a GUI with JFC/Swing. You don't need to be an expert, but you do need to be at least comfortable with reading the generated code and understanding what it does.

您需要了解的第二件事是使用任何正在使用的GUI构建工具的含义.一个很大的含义是,如果有人去编辑GUI代码,那么他们将不得不使用您的工具或手动编辑代码.如果您在人们使用多个IDE和代码编辑器的环境中工作,那么使用其他工具的人将无法使用生成的代码,而不会破坏使用该工具的能力.大多数生成器以特定的方式布置其代码,以便该工具可以读取和处理它们-不同的GUI构建器生成不同的代码,并且无法轻松地使用彼此的代码.另外,由于这个原因,手动编辑代码可能会破坏GUI构建器处理生成的代码的能力.

The second thing you need to be aware of is the implications of using whatever GUI building tool that you are using. A big implication is that if someone goes to edit the GUI code, they will have to either use your tool or edit the code by hand. If you work in an environment where people are using multiple IDEs and code editors, then someone who uses a different tool then you won't be able to work with your generated code without breaking your ability to use the tool. Most generators lay out their code in a specific manner so that it can be read and processed by the tool - different GUI builders generate different code and won't be able to easily work with each other's code. Also, because of this, editing the code by hand might break the ability of a GUI builder to work with the generated code.

如果您了解该工具,该工具的用途并愿意承担风险,请继续使用它.我坚信使用任何合适的工具来完成工作,其中包括GUI生成器.

If you understand the tool, what it does, and are willing to accept the risks, go for it. I'm a firm believer in using whatever tools are appropriate to get the job done and that includes GUI builders.

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

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