IntelliJ IDEA 4 新特性 之 GUI Designer(图形界面 RAD)
扫描二维码
随时随地手机看文章
(译者注:在看下面的翻译前最好下载一下视频DEMO 推荐!)
http://www.jetbrains.com/idea/training/demos/UI_Designer1_Deploy.zip
http://www.jetbrains.com/idea/training/demos/UI_Designer2_Deploy.zip
http://www.jetbrains.com/idea/training/demos/UI_Designer3_Deploy.zip
IDEA’s new innovative GUI designer uses a grid paradigm for the quick and easy creation and maintenance of both complex and simple component layouts. Due to unique byte-code instrumentation techniques your sources will no longer be cluttered with tons of hard-to-maintain GUI-constructing code.
IDEA引入个具有革命性的用户界面设计,你可以用表格轻易的创建和维护那些不管是简单的还是复杂的用户界面布局。由于首创 byte-code instrumentation 技术的引入,使你的程序中再也没有臃肿拖沓的界面构造代码。
Visual form creation and modification(可视化的表单创建与修改)
A rich set of visual form-building tools is incorporated into a convenient editor pane. With the help of an intuitive user interface, you can quickly learn and start using the GUI Designer.
一个功能强大的GUI Designer被集成于编辑器中,由于可以直接看到用户界面的结果你可以用GUI Designer快速开发出界面。
Even complex GUI forms can be easily created from scratch. When you need to introduce structural changes into existing GUI forms, you do not need to break the entire form layout. Re-arranging, adding or deleting GUI components can be made locally, in a quick and easy way. 即使是复杂的界面也可以被轻易的构造出来 当你需要改变一个已经设计好的Form时,你不需要打乱目前的整个Form的Layout,只需要简单的重新布局一下就可以了,不论是插入还是删除GUI components 都可以轻松搞定!(译者注:这样的界面布局设计,已经可以接近VB、Delphi的RAD了!)
GUI layout is separated from code(界面布局与代码向独立,互不影响!) GUI layout information is separated from your Java code, and is stored in devoted XML-based form files. Each GUI form is bound to a Java class, and form components are referred by class fields. Unique Byte-code instrumentation technics allow you to get rid of complicated Swing code in your Java sources. IDEA’s GUI-compiler transparently generates all code necessary to create and lay out form components. The GUI-compiler has been integrated into IDEA’s make functionality, and is also available as a separate Ant task delivered together with the IDEA distribution.
There is also an option to generate Java source code instead of using the byte-code instrumentation approach. GUI layout 的数据信息和你的Java代码相分离,它储存在一个XML格式的文件中。他们之间是绑定起来的,当然,代码可以访问你的form components的 独创的Byte-code instrumentation 技术允许你从你得Java代码中脱离掉臃肿的Swing构建代码,IDEA的 GUI-compiler 使你创建的界面代码对于你是完全透明的。GUI-compiler 的引入增强了IDEA的功能,他作为一个Ant task和IDEA一起发布。当然,你也可以用最原始的方法去开发你的Java程序,而不用byte-code instrumentation技术
(译者注:用GUI-Designer设计界面,然后GUI-compiler会帮你将这界面所保存成的XML文件和你得Java代码绑定在一起,这个技术就是byte-code instrumentation)
Binding of GUI form components to class and class fields(表单控件与class之间的绑定)
You can quickly bind your GUI form to an existing class. If there is no class, to bind with the form, you can create it right from the GUI Designer. Just enter a desired class name - the lightbulb will appear with an intention action to create a new class.
你可以快速的将你的GUI form 和一个已存在的class绑定起来,如果这个class不存在,GUI Designer会根据你的GUI form来创建一个class,只需要输入一个class名——小灯泡会醒目的出现在将要新创建的class上
Binding particular GUI components to class fields is exactly as easy as binding the form to the class.
绑定一些控件到 class 的 fields 也和这个步骤一样简单
Ant task supplied for compiling GUI forms into your builds(可视化的GUI设计在你的程序里以Ant task的方式出现)
The bundled Ant task supports byte-code instrumentation technics for compiling IDEA GUI forms. It provides the following benefits:
被绑定的 Ant task 完全支持byte-code instrumentation technics ,有以下优点:
You can quickly integrate the generated GUI forms into your project build Use of GUI designer doesn’t force you to keep all of your coding in IDEA (especially useful when team members work with different IDEs). 快速的与你的工程文件结合 这种GUI设计不一定只针对IDEA,尤其在你的同事在用其他IDE时。I18N support(支持I18N)
Text values on GUI components can be specified either by constant strings, or be obtained from the specified resource bundle.
出现在 GUI components 上的文字能以常量或资源(XML)的方式记录下来。
Ability to create custom palettes(可以创建自己的palettes)
The Additional Component Palette option (available in IDEA settings) enables you to add an additional palette of Swing components, containing your own custom UI beans and/or beans from one or more third-party libraries, to the GUI Designer’s component palette.
在IDEA设定的选项里的 Additional Component Palette 可以让你添加额外的Swing components的palette,包括你自己的或第三方的 UI beans 。
(译者注:如果还不太了解的话,可以看看那三个演示文件。说实话,若说以前我对Java的GUI设计还愤愤不满的话,那么IntelliJ IDEA 4 让我彻底的闭嘴了。)