swing插件之可视化开发工具windowb…

来源:互联网 发布:网络劫持什么意思 编辑:程序博客网 时间:2024/05/20 10:56

windowbuilder,也就是原来的SWTDesigner。Google收购了Instantiations,把它的工具也重新免费发布了。
用过swt designer的人都知它是非常好用的swing/swt可视化开发工具,有了它,swing/swt也可以像visualstudio一样拖拉控件写程序(虽然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 NewSoftware,单击Work with后的Add按钮,输入与你Eclipse对应版本的更新地址,我的是3.5版本

单击确定后,就可以在列表中看到相关的安装文件。点击next一路安装下去。

安装完成后,重启Eclipse,点击File→New→Project...

 

新建JFrame

 

生成的代码也很干净

[java] viewplaincopyprint?在CODE上查看代码片派生到我的代码片
  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.     public static void main(String[] args)  
  23.         try  
  24.             UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");  
  25.         catch (Throwable e)  
  26.             e.printStackTrace();  
  27.          
  28.         EventQueue.invokeLater(new Runnable()  
  29.             public void run()  
  30.                 try  
  31.                     MianFrame frame new MianFrame();  
  32.                     frame.setVisible(true);  
  33.                 catch (Exception e)  
  34.                     e.printStackTrace();  
  35.                  
  36.              
  37.         });  
  38.      
  39.   
  40.       
  41.     public MianFrame()  
  42.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
  43.         setBounds(100100450300);  
  44.         contentPane new JPanel();  
  45.         contentPane.setBorder(new EmptyBorder(5555));  
  46.         setContentPane(contentPane);  
  47.         contentPane.setLayout(null);  
  48.           
  49.         JLabel label new JLabel("\u7528\u6237\u540D");  
  50.         label.setBounds(79335415);  
  51.         contentPane.add(label);  
  52.           
  53.         textField new JTextField();  
  54.         textField.setBounds(1433020621);  
  55.         contentPane.add(textField);  
  56.         textField.setColumns(10);  
  57.           
  58.         JLabel label_1 new JLabel("\u5BC6  \u7801");  
  59.         label_1.setBounds(79895415);  
  60.         contentPane.add(label_1);  
  61.           
  62.         textField_1 new JTextField();  
  63.         textField_1.setBounds(1438620621);  
  64.         contentPane.add(textField_1);  
  65.         textField_1.setColumns(10);  
  66.           
  67.         JButton btnNe new JButton("\u767B\u9646");  
  68.         btnNe.addActionListener(new ActionListener()  
  69.             public void actionPerformed(ActionEvent e)  
  70.              
  71.         });  
  72.         btnNe.setBounds(1071559323);  
  73.         contentPane.add(btnNe);  
  74.           
  75.         JButton button_1 new JButton("\u5173\u95ED");  
  76.         button_1.setBounds(2431559323);  
  77.         contentPane.add(button_1);  
  78.      
  79.  
原创粉丝点击