package com.taover.ui; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Properties; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingConstants; import com.taover.db.Tools; public class EntityGenWindow { private JFrame frame; private JTextField tf_outputDir; private JTextField tf_dbPackage; private JTextArea ta_tableList; private Properties prop; private boolean createAllTable; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { EntityGenWindow window = new EntityGenWindow(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public EntityGenWindow() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 746, 464); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.setTitle("生成实体文件"); panel.setLayout(null); JLabel lblNewLabel = new JLabel("表名列表"); lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT); lblNewLabel.setVerticalAlignment(SwingConstants.TOP); lblNewLabel.setBounds(40, 66, 89, 15); panel.add(lblNewLabel); JLabel label = new JLabel("数据库配置文件"); label.setBounds(40, 29, 89, 15); panel.add(label); JComboBox comboBox = new JComboBox(); comboBox.setBounds(139, 26, 249, 21); this.initPropCombobox(comboBox); panel.add(comboBox); ta_tableList = new JTextArea(); ta_tableList.setTabSize(4); ta_tableList.setBounds(139, 62, 516, 157); panel.add(ta_tableList); JLabel label_1 = new JLabel("输出文件夹"); label_1.setBounds(40, 243, 89, 15); panel.add(label_1); tf_outputDir = new JTextField(); tf_outputDir.setBounds(139, 240, 413, 21); panel.add(tf_outputDir); tf_outputDir.setColumns(10); JLabel lblClass = new JLabel("CLASS包名"); lblClass.setBounds(40, 283, 89, 15); panel.add(lblClass); tf_dbPackage = new JTextField(); tf_dbPackage.setColumns(10); tf_dbPackage.setBounds(139, 280, 413, 21); panel.add(tf_dbPackage); JButton btnNewButton = new JButton("生成文件"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { List tableNameList = new ArrayList(); String tableNameStr = ta_tableList.getText(); String[] tableNameSplitBack = tableNameStr.split("\n"); for(int i=0; i