权威的Java Swing入门指南和参考是什么? [英] What's the definitive Java Swing starter guide and reference?

查看:123
本文介绍了权威的Java Swing入门指南和参考是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很明显 Java API 参考,但是还有什么你们都在那里用吗?

Obviously the Java API reference, but what else is there that you all use?

我整个职业生涯都在从事网络开发.最近,我一直在与 Groovy 纠缠很多,我决定在 Griffon 只是为了更多地尝试Groovy并在桌面开发方面有所突破.唯一的事情是,我在桌面应用程序方面完全是绿色的.

I've been doing web development my entire career. Lately I've been messing around a lot with Groovy and I've decided to do a small application in Griffon just to experiment more with Groovy and also break some ground in desktop development. The only thing is I'm totally green when it comes to desktop apps.

那么,世界上哪里有个不错的起点?

So, world, where's a good place to start?

推荐答案

Swing教程很好.除此之外,Swing API显然是 the 引用,但是它也是相当不错的源代码的宝库!将API源添加到IDE中,您可以直接跳转到所有Swing类的实现.这是探索功能,查看各种Swing组件如何工作以及学习良好的Swing样式"的好方法.此外,如果事情似乎不起作用并且您不知道为什么原因,那么能够逐步遍历API类是很棒的选择!将API源添加到IDE的另一个好处是,您可以同时获取所有JavaDoc,尽管所有现代IDE也可以将它们

The Swing Tutorial is very good. Apart from that, the Swing API is obviously the reference, however it's also a treasure trove of fairly good source code! Add the API source to your IDE and you can jump directly to the implementation to all the Swing classes. This is a great way to explore the functionality, see how various Swing components work and learn a good Swing "style". Furthermore, it's great to be able to step through the API classes if things don't seem to work and you have no idea why! Adding the API source to the IDE has the additional benefit that you get all the JavaDocs along with it, although all modern IDEs can also pull them from the net -- you do not want to program desktop Java without the documentation available from within the IDE!

NetBeans和其他IDE确实使IDE的创建非常容易,但是请注意,Swing除了容器和布局管理器之外,还有很多其他功能.实际上,容器和布局管理器是比较容易的事情,我建议也学习手动使用它们.使用GUI生成器并没有什么错,但是在某些情况下,这是过大的了,因此从源代码中快速生成GUI会更好.在其他情况下,您需要能够动态创建GUI,然后GUI构建器根本就没有用!要从源代码创建非常复杂的布局,我建议使用 FormLayout ,它具有自己的一套怪癖,但这确实可以(在编程方面)扩展到非常大的框架和布局.

NetBeans and other IDEs do make the creation of IDEs very easy, but be aware that there is a lot more to Swing than just containers and layout managers. In fact, containers and layout managers are among the easier things, and I'd recommend learning to use them by hand, too. There is nothing at all wrong with using a GUI builder, but in some cases it's overkill, and then it's nicer to just quickly whip up a GUI from source. In other cases you need to be able to create a GUI dynamically and then GUI builders are no use at all! For creating very complex layouts from source, I recommend FormLayout, which has its own set of quirks, but which does scale (in terms of programming effort) to very big frames and layouts.

如果到目前为止您只做过Groovy,您会惊讶地发现Swing和Java API的其余部分记录得很好,并且所有东西都集成得很好.可能还需要一些习惯来适应不同的编程风格,更多地使用调试器,而较少使用println-debugging,等等.还可能会有一些样板"代码会非常令人讨厌. ;)享受.

If you've only done Groovy so far, you'll be surprised how well documented Swing and the rest of the Java API is and how well everything is integrated. It might also take some getting used to a different style of programming, using the debugger more often and println-debugging less, etc. There might also be some "boiler-plate" code that will be very annoying. ;) Enjoy.

这篇关于权威的Java Swing入门指南和参考是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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