简体   繁体   English

新手Java UI开发

[英]Java UI development for newbie

I'm a newbie as far as Java UI development is concerned. 就Java UI开发而言,我是一个新手。 I was initially of the conception that Java UIs can be easily and efficiently developed by Netbeans or any other IDE. 我最初的想法是可以通过Netbeans或任何其他IDE轻松而有效地开发Java UI。 However, using an IDE seems to magnify the problem of learning much greater. 但是,使用IDE似乎会放大学习的问题。

I'm posing an open question to all UI developers. 我向所有UI开发人员提出了一个开放的问题。 What are the skills I should inculcate before I start off? 我起步前应该教什么技能? Is my decision to start with basic code instead of an IDE based approach better? 我决定从基本代码开始而不是基于IDE的方法更好吗? I'm done with my back end design and I found it to be a great process but I'm stuck with my UI. 我已经完成了后端设计,发现这是一个很棒的过程,但是我坚持使用UI。

PS- I'm reasonably ok as far as design and implementation of the back end but I don't seem to get any close to even 'OK' in the front end. PS-就后端的设计和实现而言,我还可以,但是在前端我什至看不到“ OK”。 It would be great if any UI developer could share his funda with me/direct me to it. 如果任何UI开发人员都可以与我共享他的基础知识/将我引导到它,那将是很棒的。 I don't want to learn it just for this project alone but I really want to learn it well. 我不想只为这个项目学习它,但我真的想很好地学习它。 Please help. 请帮忙。 Thanks. 谢谢。

Java GUI development can be a tricky beast to master. Java GUI开发可能是个棘手的难题。 The layout managers do take some time to understand, and I fully agree with you - the IDE is not the best way to learn about GUI design. 布局经理确实需要一些时间来理解,我完全同意您的观点-IDE并不是学习GUI设计的最佳方法。

I'd humbly suggest you go through the Swing Trail at http://download.oracle.com/javase/tutorial/uiswing/ to first understand the basic building blocks of GUI design in Java. 我会谦虚地建议您浏览http://download.oracle.com/javase/tutorial/uiswing/的Swing Trail,以首先了解Java中GUI设计的基本构建块。 Only after you understand how everything slots together, try to use the IDE. 只有在了解了所有内容如何组合在一起之后,才尝试使用IDE。 That way, you will know what you want to do and how you wish to design your GUI, making the IDE a valuable tool. 这样,您将知道您想做什么以及如何设计GUI,从而使IDE成为有价值的工具。

As with almost everything, it comes down to design - being able to design your GUI on paper before you design it on the computer. 几乎所有内容都取决于设计-能够在纸上设计GUI之前在纸上设计GUI。 You should know if you want a GridBagLayout or a FlowLayout or something else before you hit the IDE. 在单击IDE之前,您应该知道是否需要GridBagLayout或FlowLayout或其他东西。

GUI design is all about practice - I spent a lot of time designing small GUI's until I understood how borders and spacing and padding and spanning make a difference in my GUI's. GUI设计完全是关于实践的-我花了很多时间设计小型GUI,直到我了解边框,间距,填充和跨度如何对我的GUI有所影响。

It's all about the basics, so go through the Swing tutorial and then revisit the GUI designers in the IDE, they will make a lot more sense then. 这都是关于基础的,因此,请仔细阅读Swing教程,然后在IDE中重新访问GUI设计器,然后他们将变得更加有意义。

If you are using a more modern Java stack, like Java 8 or later, it's worth to check out JavaFX as well - it builds on Swing, using a more modern approach. 如果您使用的是Java 8或更高版本等更现代的Java堆栈,那么也值得一试JavaFX-它使用更现代的方法基于Swing构建。 I'd recommend it to anyone looking to build a modern Java desktop application. 我将它推荐给希望构建现代Java桌面应用程序的任何人。

Yes an IDE has a learning curve associated with it. 是的,IDE具有与之相关的学习曲线。 You will find it an invaluable tool nonetheless. 尽管如此,您仍将发现它是一个无价的工具。

THe IDE payoffs is when you are trying to learn in several ways: 当您尝试通过多种方式学习时,IDE的收益是:

  1. The IDE has built in templates to get you started. IDE内置了模板,可以帮助您入门。 If you are doing a Swing application you get to the "Hello World" stage for free. 如果您正在执行Swing应用程序,则可以免费进入“ Hello World”阶段。

  2. When you are working on programs, you can get to the java documentation quickly. 处理程序时,可以快速访问Java文档。

  3. THe modern IDEs compile your code in real time -- so you don't waste time with compile cycles that end up in error state. 现代的IDE实时编译您的代码-因此,您不会浪费时间以错误状态结束的编译周期。

  4. When doing Swing, Netbeans will generate massive amounts of boilerplate code for you that you would otherwise have to a) learn and b) type by hand. 在执行Swing时,Netbeans将为您生成大量的样板代码,否则您将必须a)学习和b)手动输入。 This will really become apparent the first time you try to put a form together. 当您第一次尝试将表格组合在一起时,这确实很明显。 The free-form mode of Netbeans for Swing/AWT form editing is really good. Netbeans的Swing / AWT表单编辑的自由格式模式非常好。

I can't be more specific now. 我现在不能更具体了。 Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM