swing/swt可视化开发工具windowbuilder免费了
转载:http://www.blogjava.net/pengo/archive/2010/09/19/332482.html
windowbuilder,也就是原来的SWT Designer。Google收购了Instantiations,把它的工具也重新免费发布了。
用过swt designer的人都知它是非常好用的swing/swt可视化开发工具,有了它,swing/swt也可以像visual studio一样拖拉控件写程序(虽然netbean也可以,不过没怎用),可惜是个收费产品,后来把改名为windowbuilder。不过Google把这个工具的开发公司Instantiations收购了,并把这个产品免费发布。Google收购Instantiations是为了给它的GWT设计开发工具,据说也是为了它的Anroid搞开发工具(......)。
安装地址:http://code.google.com/intl/zh-CN/webtoolkit/tools/download-wbpro.html
安装windowbuilder很方便,不过通过Eclipse的Update方式安装这个插件,eclipse的windowbuilder更新地址:
Eclipse 3.6 (Helios)
http://dl.google.com/eclipse/inst/d2wbpro/latest/3.6
Eclipse 3.5 (Galileo)
http://dl.google.com/eclipse/inst/d2wbpro/latest/3.5
Eclipse 3.4 (Ganymede)
http://dl.google.com/eclipse/inst/d2wbpro/latest/3.4
打开Eclipse,打开菜单Help→Install New Software,单击Work with后的Add按钮,输入与你Eclipse对应版本的更新地址,我的是3.5版本
单击确定后,就可以在列表中看到相关的安装文件。点击next一路安装下去。
安装完成后,重启Eclipse,点击File→New→Project...
新建JFrame
生成的代码也很干净
1 import java.awt.BorderLayout; 2 import java.awt.EventQueue; 3 4 import javax.swing.JFrame; 5 import javax.swing.JPanel; 6 import javax.swing.border.EmptyBorder; 7 import javax.swing.JLabel; 8 import javax.swing.JTextField; 9 import javax.swing.JButton; 10 import java.awt.event.ActionListener; 11 import java.awt.event.ActionEvent; 12 import javax.swing.UIManager; 13 14 15 public class MianFrame extends JFrame { 16 17 private JPanel contentPane; 18 private JTextField textField; 19 private JTextField textField_1; 20 21 /** *//** 22 * Launch the application. 23 */ 24 public static void main(String[] args) { 25 try { 26 UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 27 } catch (Throwable e) { 28 e.printStackTrace(); 29 } 30 EventQueue.invokeLater(new Runnable() { 31 public void run() { 32 try { 33 MianFrame frame = new MianFrame(); 34 frame.setVisible(true); 35 } catch (Exception e) { 36 e.printStackTrace(); 37 } 38 } 39 }); 40 } 41 42 /** *//** 43 * Create the frame. 44 */ 45 public MianFrame() { 46 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 47 setBounds(100, 100, 450, 300); 48 contentPane = new JPanel(); 49 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 50 setContentPane(contentPane); 51 contentPane.setLayout(null); 52 53 JLabel label = new JLabel("\u7528\u6237\u540D"); 54 label.setBounds(79, 33, 54, 15); 55 contentPane.add(label); 56 57 textField = new JTextField(); 58 textField.setBounds(143, 30, 206, 21); 59 contentPane.add(textField); 60 textField.setColumns(10); 61 62 JLabel label_1 = new JLabel("\u5BC6 \u7801"); 63 label_1.setBounds(79, 89, 54, 15); 64 contentPane.add(label_1); 65 66 textField_1 = new JTextField(); 67 textField_1.setBounds(143, 86, 206, 21); 68 contentPane.add(textField_1); 69 textField_1.setColumns(10); 70 71 JButton btnNe = new JButton("\u767B\u9646"); 72 btnNe.addActionListener(new ActionListener() { 73 public void actionPerformed(ActionEvent e) { 74 } 75 }); 76 btnNe.setBounds(107, 155, 93, 23); 77 contentPane.add(btnNe); 78 79 JButton button_1 = new JButton("\u5173\u95ED"); 80 button_1.setBounds(243, 155, 93, 23); 81 contentPane.add(button_1); 82 } 83 }