简体   繁体   English

Netbeans GUI Builder

[英]Netbeans GUI Builder

I have a rather large application. 我有一个相当大的应用程序。 I have used the Netbeans GUI builder for most of the GUI work. 我已经将Netbeans GUI构建器用于大多数GUI工作。 Now that the project is starting to get large, I was wondering if this was advisable. 既然项目开始变大,我想知道这是否可取。 Is it best to create the GUI's by hand so that I can have greater control over them? 是否最好手动创建GUI,以便我可以更好地控制它们? Is it advisable to stay away from the GUI builder or stick with it. 建议远离GUI构建器或坚持使用它。 Could you share some of your experience? 你能分享一些经验吗?

Thanks 谢谢

EDIT: 编辑:

See this is why I asked this question. 看到这就是我问这个问题的原因。 It seems like different people all have their opions. 似乎不同的人都有自己的想法。 Mine personally is that it works nice for small projects, but when things start to get complex, the GUI editor can be a hassle to use. 我个人认为它适用于小型项目,但是当事情开始变得复杂时,GUI编辑器可能会很麻烦。

Absolutely, doing it by hand it preferred. 绝对是,手工做它首选。 The GUI Builder is handy for prototypes and quick throwaway code. GUI Builder非常适合原型和快速一次性代码。 Anything that is going to be maintained, customized or complex will be much less of a headache long-term if you do it by hand. 如果你手工完成,任何将要维护,定制或复杂的东西都不会长期头疼。

I like the Swing GUI builder and I do use it in a large project. 我喜欢Swing GUI构建器,我在大型项目中使用它。

Really simple dialogs I just code "by hand". 真正简单的对话我只是“手工编写”。

When changing/creating more complex ones I prefer the GUI builder because I can immediately see how the form/dialog will look like. 在更改/创建更复杂的构建器时,我更喜欢GUI构建器,因为我可以立即看到窗体/对话框的外观。

Once you get the hang of the GUI builder I don't feel I have less control over it than when coding by hand. 一旦掌握了GUI构建器,我就不会觉得我对它的控制比对手工编码的控制要少。

GUI构建器可以使您的开发更快。

Stay miles away from the GUI Builder. 远离GUI Builder几英里远。 You can have a poll with all developers who have worked with Netbeans GUI builder extensively, they will all share horror stories. 您可以与所有与Netbeans GUI构建器广泛合作的开发人员进行投票,他们都会分享恐怖故事。 Is this swing application? 这个秋千申请?

Netbeans tried their hand on Visual JSF, just google it to see how it went? Netbeans尝试使用Visual JSF,只是google看看它是怎么回事?

Note: If its a swing application (or other desktop application), then please take my answer with a pinch of salt. 注意:如果它是一个swing应用程序(或其他桌面应用程序),那么请用一小撮盐来回答我的问题。 I have not used netbeans GUI developer for that. 我没有使用netbeans GUI开发人员。 But my general opinion is Netbeans tries to do a lot of things and does off of them badly. 但我的一般观点是Netbeans试图做很多事情并且做得很糟糕。

Absolutely Netbeans GUI builder. 绝对Netbeans GUI构建器。 Saves time and allows quick changes and control. 节省时间并允许快速更改和控制。 Perfect for small or huge projects and group development. 适用于小型或大型项目和团队开发。 Unit testing and debugging is included. 包括单元测试和调试。 You can extend the GUI using your own beans. 您可以使用自己的bean扩展GUI。 Everything is completely transparent. 一切都完全透明。 You can drop it and use an editor anytime you like, i bet you never will. 你可以放弃它并随时使用编辑器,我打赌你永远不会。

The Netbeans GUI Builder is one of the few GUI building tools that do their job right in my opinion. 在我看来,Netbeans GUI Builder是为数不多的GUI构建工具之一。 However, what is especially good about Netbeans is that it doesn't use any kind of intermediate library or custom XML format to store the generated GUI. 但是,Netbeans的特别之处在于它不使用任何类型的中间库或自定义XML格式来存储生成的GUI。 It's plain Java code that gets generated. 它是生成的普通Java代码。 And this code looks sensible too, especially if you name your components sensibly, not just jLabel1 kind of stuff. 而且这段代码看起来也很合理,特别是如果你明智地命名你的组件,而不仅仅是jLabel1类的东西。 This means that you can use the GUI Builder, then switch to maintaining the code manually later if you really want to. 这意味着您可以使用GUI Builder,然后切换到以后手动维护代码(如果您确实需要)。

Note that I never tried to perform anything like that, so there may be some problems I am unaware of. 请注意,我从未尝试过执行此类操作,因此可能会出现一些我不知道的问题。 But then again I was always happy with the GUI Builder so I didn't really need to switch. 但是我再次对GUI Builder感到满意,所以我真的不需要切换。

My very recent experience is with a large project that uses Netbeans GUI Builder-generated forms for panels. 我最近的经验是使用Netbeans GUI Builder生成的面板表单的大型项目。

Pros : 优点

  • it is fast 它很快
  • it adds a layer of abstraction to GUI specific details 它为GUI特定细节添加了一层抽象

Cons : 缺点

  • it fastens developer's hands when it comes to fixing details in the generated code. 在修改生成的代码中的细节时,它会固定开发人员的手。 Example from my very recent experience 我最近的经历中的例子
  • UI controls are difficult to refactor UI控件很难重构
  • UI controls are impossible to extend and override UI控件无法扩展和覆盖

I would say it is not a good idea to use it in a large project, especially if reuse and extension of UI controls is expected(which almost always becomes the case for big projects). 我想说在大型项目中使用它并不是一个好主意,特别是如果期望重用和扩展UI控件(大型项目几乎总是如此)。

I had the same problem with large Netbeans projects. 我遇到了大型Netbeans项目的同样问题。 In the GUI-Designer if I want to add an action I sometimes get the option "Set Action..." (on creation of a new GUI this is not available, just after opening Netbeans again). 在GUI-Designer中如果我想添加一个动作,我有时会得到“Set Action ...”选项(在创建一个新的GUI时,这是不可用的,只是在再次打开Netbeans之后)。 If you use this Netbeans creates in initComponents() 如果你在initComponents()中使用这个Netbeans创建

javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(GUIClass.class, this);

All code after this will not be executed or just partly executed (I didn't examine it exactly). 之后的所有代码都不会被执行或只是部分执行(我没有完全检查它)。 Use actionPerformed instead. 请改用actionPerformed

This works at the moment but Netbeans has to update this. 这在目前是有效的,但Netbeans必须更新它。

Our application has over 600 GUI-designed forms and we very rarely have any issues at all. 我们的应用程序有超过600个GUI设计的表单,我们很少有任何问题。 If we do encounter problems, we usually just use SVN to discard the current changes and try again. 如果我们确实遇到问题,我们通常只使用SVN来丢弃当前的更改并再试一次。

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

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