您的位置:首页 > 运维架构 > Tomcat

JAVA开发环境的搭建―――JDK+TOMCAT+eclipse

2013-07-25 17:10 691 查看
<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog01.html" frameborder="0" width="728" scrolling="no" height="90"></iframe>
Netbeans FormDesigner的确非常的强大。我现在的一个Swing项目采取的开发方法是,使用netbeans的form designer设计界面。当然设计出来的界面只包含组件的定义。也就相当于MVC的View,所有控制类放到一个Controller里面。

要快速上手Form Desinger的方法就是要学会看懂它的.form文件。这个文件是xml格式的,因此非常容易懂。

一般的格式都是这样的,先定义布局。例如GridLayout ,2行1列

<layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout"><br><property name="columns" type="int" value="1"></property><br><property name="horizontalGap" type="int" value="5"></property><br><property name="rows" type="int" value="2"></property><br><property name="verticalGap" type="int" value="5"></property><br></layout>

包含两个用于布局的panel
<subcomponents><br><container class="javax.swing.JPanel" name="aliasPnl"></container></subcomponents>

<layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout"><br><property name="columns" type="int" value="2"></property><br><property name="rows" type="int" value="1"></property><br></layout>
<subcomponents></subcomponents>

存放一个登陆用的下拉框
<component class="javax.swing.JLabel" name="loginAliasesLbl"><br><properties><br><property name="horizontalAlignment" type="int" value="0"></property><br><property name="text" type="java.lang.String" value="Choose Alias"></property><br></properties><br></component>
<component class="javax.swing.JComboBox" name="loginAliasesCbo"><br></component>

<container class="javax.swing.JPanel" name="buttonPnl"></container>

<layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout"><br><property name="columns" type="int" value="3"></property><br><property name="horizontalGap" type="int" value="5"></property><br><property name="rows" type="int" value="1"></property><br><property name="verticalGap" type="int" value="5"></property><br></layout>

三个按钮并排放
<subcomponents><br><component class="javax.swing.JButton" name="manageBtn"><br><properties><br><property name="mnemonic" type="int" value="109"></property><br><property name="text" type="java.lang.String" value="Manage a/cs"></property><br></properties><br></component><br><component class="javax.swing.JButton" name="loginBtn"><br><properties><br><property name="mnemonic" type="int" value="108"></property><br><property name="text" type="java.lang.String" value="Login"></property><br></properties><br></component><br><component class="javax.swing.JButton" name="cancelBtn"><br><properties><br><property name="mnemonic" type="int" value="99"></property><br><property name="text" type="java.lang.String" value="Cancel"></property><br></properties><br></component><br></subcomponents>

把这个文件摸透以后,在来使用GUI就直观多了,按照左下角的导航栏来设计模块的包含非常的简单。

这个世界上的GUI IDE有两种逻辑,一种是把事情做好。不管花什么代价。另一种是代价要最小,不管东西好不好,能用就行。

Swing是前者。VB是后者

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=480532
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: