发展部件技术分享 http://blog.sciencenet.cn/u/求新 研究方向:数据库、MIS,教育部教指委计算机分委会专家工作组成员

博文

管理信息系统软件生产线源码15-18

已有 1599 次阅读 2018-5-28 20:14 |个人分类:生活点滴|系统分类:科研笔记| 软件生产线, 软部件, 数据库, 管理信息系统, JAVA

版本1
15.源码15,生成表格式报表格式文件

/*
 * 程序文件名:printFormat1.java
 * 作者:程学先
 * 本程序用于辅助生成打印数据库中单数据表的表格式报表格式文件。
 * 程序功能:用于dataPrint1、printPreview1等程序生成格式文件
 * 所有参数以字符个数为单位,辅助计算后变换为象素单位。
 * 在打印报表中设置的宽度、高度、左边距、到顶距等待填入字符单位数据再根据字号计算其象素单位值
 * 所有数据保存在一个文件中
 * 每组内容第一个数据标志组类型,1表示总标题(全表一次);
 * 2表示表头(每页一次);3表示表格内容(根据记录情况重复)。
 * 4表示页尾内容(每页一次)
 * 5表示表尾内容(全表一次)
 * 总标题部分、页尾部分、表尾部分内容分常量与变量二类,常量照原样打印,
 * 变量可以为字段名,可以为当前日期、页号等。
 * 程序共分为5页,第一页尾标题页,可以输入标题内容及副标题、作者……等
 * 输入时先输入内容,输入以字符个数为单位的宽度、高度、左边距、到顶距、字体、字号等
 * 每输入一行内容点击添加到表格中按钮。
 * 全部输入完成后,点击“辅助计算”按钮。
 * 第2页输入表头标签内容。
 * 表头部分全部为常量,每页打印一次内容相同。
 * 输入时选字段名,点击添加到表格中按钮,再输入下一个标签。
 * 第3页输入表格内容,输入时选字段名,点击添加到表格中按钮,再输入下一个字段名。
 * 表格内容来自对数据表的查询程序,每行对应一条记录部分字段的数据,
 * 表尾内容分常量与变量二类,常量照原样打印,变量的打印内容在调用程序中设置。
 * 总标题、页尾、表尾部分属性包括:内容、变量名、行号、列号、宽度、高度、左边距、到顶距、
 * 字体、字号等10个参数
 * 表头部分属性包括:字段标签名称、行号、列号、宽度、高度、左边距、
 * 字体、字号、有无下表格线、有无右表格线等10个参数
 * 表体部分属性包括:字段名称、宽度、字体、字号、有无下表格线、有无右表格线等6个参数
 * 如果按下“辅助计算”按钮,将帮助从字符数计算象素点数。
 * 操作结果将替代已经输入的所有边距、宽度、高度、到顶距等数字。
 * 辅助布局要求先按从上到下、从左到右输入各数据的名字、行号 与列号、
 * 字体、字号、有无下表格线、有无右表格线。
 * 要求全表数据统一字号。
 * 操作自动布局前,请一定检查上述内容都已经输入后再点击辅助计算。
 */
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.table.*;
import javax.swing.tree.DefaultMutableTreeNode;

import java.io.*;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Vector;

public class printFormat1 extends JFrame {
 private static printFormat1 frame1 = new printFormat1(); // 定义窗口
 private static printFormat1 frame2 = new printFormat1();
 private static printFormat1 frame3 = new printFormat1();
 private static printFormat1 frame4 = new printFormat1();
 private static printFormat1 frame5 = new printFormat1();
 private static JPanel panel1 = new JPanel(); // 定义面板
 private static JPanel panel2 = new JPanel();
 private static JPanel panel3 = new JPanel();
 private static JPanel panel4 = new JPanel();
 private static JPanel panel5 = new JPanel();
 private static DefaultTableModel 表格模型1; // 定义表格模型对象
 private static DefaultTableModel 表格模型2;
 private static DefaultTableModel 表格模型3;
 private static DefaultTableModel 表格模型4;
 private static DefaultTableModel 表格模型5;
 private static JTable 表格1; // 定义表格对象
 private static JTable 表格2;
 private static JTable 表格3;
 private static JTable 表格4;
 private static JTable 表格5;
 private static JScrollPane scrollPane1 = new JScrollPane(); // 定义表格滚动条
 private static JScrollPane scrollPane2 = new JScrollPane();
 private static JScrollPane scrollPane3 = new JScrollPane();
 private static JScrollPane scrollPane4 = new JScrollPane();
 private static JScrollPane scrollPane5 = new JScrollPane();
 private static List list1 = new List();
 private static List list2 = new List();
 private static List list3 = new List();
 private static List list4 = new List();
 private static List list5 = new List();
 private static JLabel fl0, fl1, fl2, fl3, fl4, fl5, fl6, fl7, fl8, fl9,
   fl10, fl11, fl12;
 private static JTextField fa0, fa1, fa2, fa3, fa4, fa5, fa6, fa7, fa8, fa9,
   fa10, fa11, fa12;

 private static JLabel fla0, fla1, fla2, fla3, fla4, fla5, fla6, fla7, fla8,
   fla9, fla10, fla11, fla12;
 private static JTextField faa0, faa1, faa2, faa3, faa4, faa5, faa6, faa7,
   faa8, faa9, faa10, faa11, faa12;

 private static JLabel flb0, flb1, flb2, flb3, flb4, flb5, flb6, flb7, flb8,
   flb9, flb10, flb11, flb12;
 private static JTextField fab0, fab1, fab2, fab3, fab4, fab5, fab6, fab7,
   fab8, fab9, fab10, fab11, fab12;

 private static JLabel flc0, flc1, flc2, flc3, flc4, flc5, flc6, flc7, flc8,
   flc9, flc10, flc11, flc12;
 private static JTextField fac0, fac1, fac2, fac3, fac4, fac5, fac6, fac7,
   fac8, fac9, fac10, fac11, fac12;

 private static JLabel fld0, fld1, fld2, fld3, fld4, fld5, fld6, fld7, fld8,
   fld9, fld10, fld11, fld12;
 private static JTextField fad0, fad1, fad2, fad3, fad4, fad5, fad6, fad7,
   fad8, fad9, fad10, fad11, fad12;

 private static String 当前值;
 private static int 选中行号 = -1, 当前行号 = 0, 表格行数 = 0, 当前列号 = 0, 列数 = 0;
 private static int 字段序号 = 0;
 private static String[][] 表格数据;
 private static ArrayList<String> 读入数据 = new ArrayList();
 private static String[] 列名1; // 数据表中列名
 private static String[] 列数据类型;
 private static int[] 列数据宽度;
 private static String[] 一行数据 = new String[12];
 private static int[] 一行数据1 = new int[12];
 private static File file1;
 static Connection con; // 连接数据库
 static String url;
 static String DBMS系统 = "sqlserver";
 static String ODBC数据源 = "sql1";
 private static Statement sta; // 连接数据库
 static String s1 = "", s2 = "";
 private static ResultSet rs;
 private static ResultSetMetaData rsmd;
 private static ArrayList 表名1 = new ArrayList();
 private static String[] 字号 = { "5", "6", "7", "8", "9", "10", "11", "12",
   "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72" };
 private static String[] 字体 = { "宋体", "楷体", "黑体", "仿宋_GB2312" };

 public static void means(String[] parameter) {
  String 表名 = parameter[4]; // 数据表名 fa0
  frame1 = new printFormat1(); // 定义窗口
  frame2 = new printFormat1();
  frame3 = new printFormat1();
  frame4 = new printFormat1();
  frame5 = new printFormat1();
  panel1 = new JPanel(); // 定义面板
  panel2 = new JPanel();
  panel3 = new JPanel();
  panel4 = new JPanel();
  panel5 = new JPanel();
  scrollPane1 = new JScrollPane(); // 定义表格滚动条
  scrollPane2 = new JScrollPane();
  scrollPane3 = new JScrollPane();
  scrollPane4 = new JScrollPane();
  scrollPane5 = new JScrollPane();
  list1 = new List();
  list2 = new List();
  list3 = new List();
  list4 = new List();
  list5 = new List();
  选中行号 = -1;
  当前行号 = 0;
  表格行数 = 0;
  当前列号 = 0;
  列数 = 0;
  字段序号 = 0;
  读入数据 = new ArrayList();
  一行数据 = new String[12];
  一行数据1 = new int[12];
  DBMS系统 = "sqlserver";
  ODBC数据源 = "sql1";
  s1 = "";
  s2 = "";
  表名1 = new ArrayList();
  字号 = new String[19];
  字体 = new String[4];
  字号[0] = "5";
  字号[1] = "6";
  字号[2] = "7";
  字号[3] = "8";
  字号[4] = "9";
  字号[5] = "10";
  字号[6] = "11";
  字号[7] = "12";
  字号[8] = "14";
  字号[9] = "16";
  字号[10] = "18";
  字号[11] = "20";
  字号[12] = "22";
  字号[13] = "24";
  字号[14] = "26";
  字号[15] = "28";
  字号[16] = "36";
  字号[17] = "48";
  字号[18] = "72";
  字体[0] = "宋体";
  字体[1] = "楷体";
  字体[2] = "黑体";
  字体[3] = "仿宋_GB2312";
  try {
   con = main1.getConn();// 连接数据库
   sta = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
     ResultSet.CONCUR_UPDATABLE);

   s1 = "select " + parameter[19] + " from " + 表名; // 查取全表数据
   if (表名.indexOf(",") > 0)
    s1 = s1 + " where " + parameter[20];
   rs = sta.executeQuery(s1);
   rs.last(); // 移动到最后一行
   rsmd = rs.getMetaData();
   列数 = rsmd.getColumnCount(); // 获取列数
   列名1 = new String[列数]; // 定义列名数组
   列数据类型 = new String[列数];
   列数据宽度 = new int[列数];
   当前列号 = 1;
   list1.removeAll();
   列名1 = parameter[19].split(",");
   for (int i = 0; i < 列数; i++) {
    列数据类型[i] = rsmd.getColumnTypeName(i + 1);
    列数据宽度[i] = rsmd.getColumnDisplaySize(i + 1);
    list1.add(列名1[i]);
   }
   rs.close();
   sta.close();
   con.close();
  } catch (SQLException e1) {
   JOptionPane.showMessageDialog(null, "获取数据结构出错!" + s1);
  }

  frame1.setTitle("打印报表标题设计页,每表打印一次。                           作者:程学先"); // 窗口标题
  frame2.setTitle("表头设计页,每页打印一次。                           作者:程学先");
  frame3.setTitle("报表表体内容设计页,每条记录打印一次。                           作者:程学先");
  frame4.setTitle("打印报表页尾设计页,每页打印一次。                           作者:程学先");
  frame5.setTitle("打印报表表尾设计页,每表打印一次。                           作者:程学先");

  frame1.setBounds(10, 10, 1000, 660); // 窗口位置大小
  frame2.setBounds(100, 10, 1000, 660);
  frame3.setBounds(200, 10, 1000, 660);
  frame4.setBounds(10, 120, 1000, 600);
  frame5.setBounds(200, 120, 1000, 600);

  frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // 设置窗体的默认关闭模式
  frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame3.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame4.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame5.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

  panel1.setBounds(10, 10, 1000, 660); // 定义面板大小与位置
  panel2.setBounds(100, 10, 1000, 660);
  panel3.setBounds(200, 10, 1000, 660);
  panel4.setBounds(10, 120, 1000, 600);
  panel5.setBounds(200, 120, 1000, 600);

  panel1.setLayout(null); // 关闭面板布局管理器
  panel2.setLayout(null);
  panel3.setLayout(null);
  panel4.setLayout(null);
  panel5.setLayout(null);

  String[] 列名01 = { "内容或变量", "变量名", "行号", "列号", "宽度", "高度", "左边距", "到顶距",
    "字体", "字号" };
  String[] 列名02 = { "字段标签", "行号", "列号", "宽度", "高度", "左边距", "字体", "字号",
    "有无下表格线", "有无右表格线" };
  String[] 列名03 = { "字段名称", "字段宽度", "每行高度", "字体", "字号", "有无下表格线",
    "有无右表格线" };
  String[] 列名04 = { "内容或变量", "变量名", "行号", "列号", "宽度", "高度", "左边距", "到顶距",
    "字体", "字号" };
  String[] 列名05 = { "内容或变量", "变量名", "行号", "列号", "宽度", "高度", "左边距", "到顶距",
    "字体", "字号" };
  main1.driver1();
  fl0 = new JLabel("数据表名");
  fl0.setBounds(40, 10, 80, 20);
  panel1.add(fl0);
  fa0 = new JTextField("");
  fa0.setText(表名);
  fa0.setBounds(130, 10, 100, 20);
  panel1.add(fa0);
  fa0.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 0;
    list1.removeAll();
    if (表名1.size() < 1) {
     try {
      con = main1.getConn();
      String[] tableType = { "TABLE" };
      DatabaseMetaData databaseMetaData = con.getMetaData();
      ResultSet resultSet = databaseMetaData.getTables(null,
        null, "%", tableType);
      while (resultSet.next()) { // 遍历集合
       表名1.add(resultSet.getString("TABLE_NAME"));
      }
     } catch (Exception e) {
      e.printStackTrace();
     }
    }
    for (int i = 0; i < 表名1.size(); i++)
     list1.add(表名1.get(i).toString());
   }
  });

  fl10 = new JLabel("文件名");
  fl10.setBounds(250, 10, 50, 20);
  panel1.add(fl10);
  fa10 = new JTextField("", 20);
  fa10.setBounds(300, 10, 100, 20);
  panel1.add(fa10);
  fa10.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (fa10.getText().length() < 1) {
     final JFileChooser fc = new JFileChooser(".\\");
     fc.showOpenDialog(null);
     if (fc.getSelectedFile() != null) {
      fa10.setText(fc.getSelectedFile().toString());
      file1 = new File(fa10.getText());
      try {
       if (file1.exists()) {
        FileReader fr = new FileReader(file1);
        BufferedReader br = new BufferedReader(fr);
        String tempStr = null;
        读入数据.clear();
        for (int i = 0; (tempStr = br.readLine()) != null; i++) {
         if (tempStr.substring(0, 2).equals("1,")) {
          表格模型1.addRow(tempStr.substring(2,
            tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "2,")) {
          表格模型2.addRow(tempStr.substring(2,
            tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "3,")) {
          表格模型3.addRow(tempStr.substring(2,
            tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "4,")) {
          表格模型4.addRow(tempStr.substring(2,
            tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "5,")) {
          表格模型5.addRow(tempStr.substring(2,
            tempStr.length()).split("。"));
         }
        }
       }
      } catch (IOException e2) {
       JOptionPane.showMessageDialog(null, "打开文件错!");
      }
     }
    }
   }
  });

  表格模型1 = new DefaultTableModel(表格数据, 列名01); // 创建表格模型
  表格模型2 = new DefaultTableModel(表格数据, 列名02);
  表格模型3 = new DefaultTableModel(表格数据, 列名03);
  表格模型4 = new DefaultTableModel(表格数据, 列名04);
  表格模型5 = new DefaultTableModel(表格数据, 列名05);

  表格1 = new JTable(表格模型1); // 创建指定表格模型的表格
  表格2 = new JTable(表格模型2);
  表格3 = new JTable(表格模型3);
  表格4 = new JTable(表格模型4);
  表格5 = new JTable(表格模型5);

  表格1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);// 设置表格的选择模式为单选
  表格2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  表格3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  表格4.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  表格5.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

  表格1.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int 选中行号 = 表格1.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (表格模型1.getValueAt(选中行号, j) != null)
      当前值 = 表格模型1.getValueAt(选中行号, j).toString();
     else
      当前值 = "";
     switch (j) {
     case 0:
      fa1.setText(当前值.toString());
      break;
     case 1:
      fa2.setText(当前值.toString());
      break;
     case 2:
      fa11.setText(当前值.toString());
      break;
     case 3:
      fa12.setText(当前值.toString());
      break;
     case 4:
      fa3.setText(当前值.toString());
      break;
     case 5:
      fa4.setText(当前值.toString());
      break;
     case 6:
      fa5.setText(当前值.toString());
      break;
     case 7:
      fa6.setText(当前值.toString());
      break;
     case 8:
      fa7.setText(当前值.toString());
      break;
     case 9:
      fa8.setText(当前值.toString());
      break;
     case 10:
      fa9.setText(当前值.toString());
      break;
     }
    }
   }
  });
  scrollPane1.setBounds(10, 40, 800, 400);
  scrollPane2.setBounds(10, 40, 800, 400);
  scrollPane3.setBounds(10, 40, 800, 400);
  scrollPane4.setBounds(10, 40, 800, 300);
  scrollPane5.setBounds(10, 40, 800, 300);
  scrollPane1.setViewportView(表格1); // 表格滚动条加到表格中
  scrollPane2.setViewportView(表格2);
  scrollPane3.setViewportView(表格3);
  scrollPane4.setViewportView(表格4);
  scrollPane5.setViewportView(表格5);

  panel1.add(scrollPane1, BorderLayout.CENTER);// 面板中加入表格滚动条
  panel2.add(scrollPane2, BorderLayout.CENTER);
  panel3.add(scrollPane3, BorderLayout.CENTER);
  panel4.add(scrollPane4, BorderLayout.CENTER);
  panel5.add(scrollPane5, BorderLayout.CENTER);

  fl1 = new JLabel("内容");
  fl1.setBounds(70, 460, 40, 20);
  panel1.add(fl1);
  fa1 = new JTextField("", 20);
  fa1.setBounds(110, 460, 100, 20);
  panel1.add(fa1);
  fa1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 1;
    list1.removeAll();
   }
  });

  fl2 = new JLabel("变量名");
  fl2.setBounds(230, 460, 50, 20);
  panel1.add(fl2);
  fa2 = new JTextField("", 20);
  fa2.setBounds(280, 460, 60, 20);
  panel1.add(fa2);
  fa2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 2;
    list1.removeAll();
   }
  });

  fl11 = new JLabel("行号");
  fl11.setBounds(370, 460, 40, 20);
  panel1.add(fl11);
  fa11 = new JTextField("", 20);
  fa11.setBounds(410, 460, 60, 20);
  panel1.add(fa11);
  fa11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 11;
    list1.removeAll();
   }
  });

  fl12 = new JLabel("列号");
  fl12.setBounds(500, 460, 40, 20);
  panel1.add(fl12);
  fa12 = new JTextField("", 20);
  fa12.setBounds(540, 460, 60, 20);
  panel1.add(fa12);
  fa12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 12;
    list1.removeAll();
   }
  });

  fl3 = new JLabel("宽度");
  fl3.setBounds(630, 460, 40, 20);
  panel1.add(fl3);
  fa3 = new JTextField("", 20);
  fa3.setBounds(670, 460, 60, 20);
  panel1.add(fa3);
  fa3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 3;
    list1.removeAll();
   }
  });

  fl4 = new JLabel("高度");
  fl4.setBounds(760, 460, 40, 20);
  panel1.add(fl4);
  fa4 = new JTextField("", 20);
  fa4.setBounds(800, 460, 60, 20);
  panel1.add(fa4);
  fa4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 4;
    list1.removeAll();
   }
  });

  fl5 = new JLabel("左边距");
  fl5.setBounds(60, 500, 50, 20);
  panel1.add(fl5);
  fa5 = new JTextField("", 20);
  fa5.setBounds(110, 500, 100, 20);
  panel1.add(fa5);
  fa5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 5;
    list1.removeAll();
   }
  });

  fl6 = new JLabel("到顶距");
  panel1.add(fl6);
  fa6 = new JTextField("", 20);
  panel1.add(fa6);
  fl6.setBounds(220, 500, 60, 20);
  fa6.setBounds(280, 500, 60, 20);
  fa6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 6;
    list1.removeAll();
   }
  });

  fl7 = new JLabel("字体");
  panel1.add(fl7);
  fa7 = new JTextField("", 20);
  panel1.add(fa7);
  fl7.setBounds(370, 500, 40, 20);
  fa7.setBounds(410, 500, 120, 20);
  fa7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 7;
    list1.removeAll();
    for (int i = 0; i < 字体.length; i++) {
     list1.add(字体[i]);
    }
   }
  });

  fl8 = new JLabel("字号");
  panel1.add(fl8);
  fa8 = new JTextField("", 20);
  panel1.add(fa8);
  fl8.setBounds(560, 500, 40, 20);
  fa8.setBounds(600, 500, 100, 20);
  fa8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 8;
    list1.removeAll();
    for (int i = 0; i < 字号.length; i++) {
     list1.add(字号[i]);
    }
   }
  });

  list1.setBounds(840, 10, 120, 430);
  panel1.add(list1);
  list1.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list1.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (当前列号) {
     case 0: // 表名
      break;
     case 1:
      fa1.setText(list1.getSelectedItem());
      break;
     case 2:
      fa2.setText(list1.getSelectedItem());
      break;
     case 3:
      fa3.setText(list1.getSelectedItem());
      break;
     case 4:
      fa4.setText(list1.getSelectedItem());
      break;
     case 5:
      fa5.setText(list1.getSelectedItem());
      break;
     case 6:
      fa6.setText(list1.getSelectedItem());
      break;
     case 7:
      fa7.setText(list1.getSelectedItem());
      break;
     case 8:
      fa8.setText(list1.getSelectedItem());
      break;
     case 11:
      fa11.setText(list1.getSelectedItem());
      break;
     case 12:
      fa12.setText(list1.getSelectedItem());
      break;
     }
    }
   }
  });

  final JButton addButton = new JButton("添加到表格中");
  addButton.setBounds(50, 540, 120, 20);
  addButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    // 创建表格行数组
    int 选中行号 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < 表格模型1.getRowCount(); i++) {
     if ((表格模型1.getValueAt(i, 0) != null)
       && (表格模型1.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fa1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 < 0) {
     String[] rowValues = { fa1.getText(), fa2.getText(),
       fa11.getText(), fa12.getText(), fa3.getText(),
       fa4.getText(), fa5.getText(), fa6.getText(),
       fa7.getText(), fa8.getText() };
     表格模型1.addRow(rowValues);
     int rowCount = 表格1.getRowCount() + 1;
     fa1.setText("");
     fa2.setText("0");
     fa3.setText("0");
     fa4.setText("0");
     fa5.setText("0");
     fa6.setText("0");
     fa7.setText("");
     fa8.setText("0");
     fa11.setText("0");
     fa12.setText("0");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel1.add(addButton);

  final JButton updButton = new JButton("修改表格数据");
  updButton.setBounds(170, 540, 120, 20);
  updButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1;
    for (int i = 0; i < 表格模型1.getRowCount(); i++) {
     if ((表格模型1.getValueAt(i, 0) != null)
       && (表格模型1.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fa1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 >= 0) {
     表格模型1.setValueAt(fa1.getText(), 选中行号, 0);
     表格模型1.setValueAt(fa2.getText(), 选中行号, 1);
     表格模型1.setValueAt(fa11.getText(), 选中行号, 2);
     表格模型1.setValueAt(fa12.getText(), 选中行号, 3);
     表格模型1.setValueAt(fa3.getText(), 选中行号, 4);
     表格模型1.setValueAt(fa4.getText(), 选中行号, 5);
     表格模型1.setValueAt(fa5.getText(), 选中行号, 6);
     表格模型1.setValueAt(fa6.getText(), 选中行号, 7);
     表格模型1.setValueAt(fa7.getText(), 选中行号, 8);
     表格模型1.setValueAt(fa8.getText(), 选中行号, 9);
     表格模型1.setValueAt(fa9.getText(), 选中行号, 10);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel1.add(updButton);

  final JButton delButton = new JButton("从表格中删除");
  delButton.setBounds(290, 540, 120, 20);
  delButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = 表格1.getSelectedRow();
    if (选中行号 != -1)
     表格模型1.removeRow(选中行号);
   }
  });
  panel1.add(delButton);

  final JButton countButton = new JButton("辅助计算");
  countButton.setBounds(410, 540, 120, 20);
  countButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 数据条数 = 表格模型1.getRowCount();
    String[][] 数据 = new String[数据条数][11];
    int[][] 数据1 = new int[数据条数][11];
    for (int i = 0; i < 数据条数; i++) { // 保存为表格数据
     for (int j = 0; j < 10; j++)
      数据[i][j] = 表格模型1.getValueAt(i, j).toString().trim();
     for (int j = 4; j < 10; j++) {
      if (j != 8) {
       if (数据[i][j].length() > 0)
        数据1[i][j] = Integer.valueOf(数据[i][j]);
       else
        数据1[i][j] = 0;
      }
     }
     for (int j = 4; j < 8; j++) {
      if (j != 5)
       数据1[i][j] = 数据1[i][j] * 数据1[i][9];
      else
       数据1[i][j] = (int) (数据1[i][j] * 数据1[i][9] * 1.3);
      数据[i][j] = "" + 数据1[i][j];
     }
    }

    表格模型1.setRowCount(0);
    for (int i = 0; i < 数据条数; i++)
     表格模型1.addRow(数据[i]);
   }
  });
  panel1.add(countButton);

  final JButton creButton = new JButton("表格内容存盘");
  creButton.setBounds(530, 540, 120, 20);
  creButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    char x1 = 10, x2 = 13, x3 = '"', x4 = ',';
    file1 = new File(fa10.getText());
    FileOutputStream fs;
    try {
     fs = new FileOutputStream(file1);
     for (int i = 0; i < 表格模型1.getRowCount(); i++) {
      String s3 = "1,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((表格模型1.getValueAt(i, j) != null)
         && (表格模型1.getValueAt(i, j).toString()
           .length() > 0))
        s3 = s3 + 表格模型1.getValueAt(i, j).toString()
          + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }
     for (int i = 0; i < 表格模型2.getRowCount(); i++) {
      String s3 = "2,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((表格模型2.getValueAt(i, j) != null)
         && (表格模型2.getValueAt(i, j).toString()
           .length() > 0))
        s3 = s3 + 表格模型2.getValueAt(i, j).toString()
          + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }
     for (int i = 0; i < 表格模型3.getRowCount(); i++) {
      String s3 = "3,", s4 = "";
      for (int j = 0; j < 7; j++) {
       if ((表格模型3.getValueAt(i, j) != null)
         && (表格模型3.getValueAt(i, j).toString()
           .length() > 0))
        s3 = s3 + 表格模型3.getValueAt(i, j).toString()
          + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }

     for (int i = 0; i < 表格模型4.getRowCount(); i++) {
      String s3 = "4,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((表格模型4.getValueAt(i, j) != null)
         && (表格模型4.getValueAt(i, j).toString()
           .length() > 0))
        s3 = s3 + 表格模型4.getValueAt(i, j).toString()
          + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }

     for (int i = 0; i < 表格模型5.getRowCount(); i++) {
      String s3 = "5,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((表格模型5.getValueAt(i, j) != null)
         && (表格模型5.getValueAt(i, j).toString()
           .length() > 0))
        s3 = s3 + 表格模型5.getValueAt(i, j).toString()
          + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }

     fs.close();
    } catch (IOException e2) {
     JOptionPane.showMessageDialog(null, "写文件错。");
    }
   }
  });
  panel1.add(creButton);

  final JButton clearButton = new JButton("清参数文本框");
  clearButton.setBounds(650, 540, 120, 20);
  clearButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fa1.setText("");
    fa2.setText("0");
    fa3.setText("0");
    fa4.setText("0");
    fa5.setText("0");
    fa6.setText("0");
    fa7.setText("");
    fa8.setText("0");
    fa9.setText("");
    fa11.setText("0");
    fa12.setText("0");
   }
  });
  panel1.add(clearButton);

  final JButton exitButton = new JButton("退出");
  exitButton.setBounds(770, 540, 120, 20);
  exitButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    panel1.setVisible(false);
    frame1.setVisible(false);
    frame1.dispose();
    frame2.setVisible(false);
    frame2.dispose();
    frame3.setVisible(false);
    frame3.dispose();
    frame4.setVisible(false);
    frame4.dispose();
    frame5.setVisible(false);
    frame5.dispose();
   }
  });
  panel1.add(exitButton);

  fla1 = new JLabel("标签名称");
  fla1.setBounds(50, 460, 60, 20);
  panel2.add(fla1);
  faa1 = new JTextField("", 20);
  faa1.setBounds(110, 460, 100, 20);
  panel2.add(faa1);
  faa1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 1;
    list2.removeAll();
    for (int i = 0; i < 列数; i++) {
     list2.add(列名1[i]);
    }
   }
  });

  fla11 = new JLabel("行号");
  fla11.setBounds(240, 460, 40, 20);
  panel2.add(fla11);
  faa11 = new JTextField("", 20);
  faa11.setBounds(280, 460, 60, 20);
  panel2.add(faa11);
  faa11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 11;
    list2.removeAll();
   }
  });

  fla12 = new JLabel("列号");
  fla12.setBounds(370, 460, 40, 20);
  panel2.add(fla12);
  faa12 = new JTextField("", 20);
  faa12.setBounds(410, 460, 60, 20);
  panel2.add(faa12);
  faa12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 12;
    list2.removeAll();
   }
  });

  fla2 = new JLabel("宽度");
  fla2.setBounds(500, 460, 40, 20);
  panel2.add(fla2);
  faa2 = new JTextField("", 20);
  faa2.setBounds(540, 460, 60, 20);
  panel2.add(faa2);
  faa2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 2;
    list2.removeAll();
   }
  });

  fla3 = new JLabel("高度");
  fla3.setBounds(630, 460, 40, 20);
  panel2.add(fla3);
  faa3 = new JTextField("", 20);
  faa3.setBounds(670, 460, 60, 20);
  panel2.add(faa3);
  faa3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 3;
    list2.removeAll();
   }
  });

  fla4 = new JLabel("左边距");
  fla4.setBounds(750, 460, 50, 20);
  panel2.add(fla4);
  faa4 = new JTextField("", 20);
  faa4.setBounds(800, 460, 60, 20);
  panel2.add(faa4);
  faa4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 4;
    list2.removeAll();
   }
  });

  fla5 = new JLabel("字体");
  fla5.setBounds(70, 500, 40, 20);
  panel2.add(fla5);
  faa5 = new JTextField("", 20);
  faa5.setBounds(110, 500, 100, 20);
  panel2.add(faa5);
  faa5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 5;
    list2.removeAll();
    for (int i = 0; i < 字体.length; i++) {
     list2.add(字体[i]);
    }
   }
  });

  fla6 = new JLabel("字号");
  panel2.add(fla6);
  faa6 = new JTextField("", 20);
  panel2.add(faa6);
  fla6.setBounds(240, 500, 40, 20);
  faa6.setBounds(280, 500, 60, 20);
  faa6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 6;
    list2.removeAll();
    for (int i = 0; i < 字号.length; i++) {
     list2.add(字号[i]);
    }
   }
  });

  fla7 = new JLabel("有无下表格线");
  panel2.add(fla7);
  faa7 = new JTextField("", 20);
  panel2.add(faa7);
  fla7.setBounds(350, 500, 80, 20);
  faa7.setBounds(430, 500, 120, 20);
  faa7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 7;
    list2.removeAll();
    list2.add("有");
    list2.add("无");
   }
  });

  fla8 = new JLabel("有无右表格线");
  panel2.add(fla8);
  faa8 = new JTextField("", 20);
  panel2.add(faa8);
  fla8.setBounds(560, 500, 80, 20);
  faa8.setBounds(640, 500, 100, 20);
  faa8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 8;
    list2.removeAll();
    list2.add("有");
    list2.add("无");
   }
  });

  faa1.setText("");
  faa2.setText("0");
  faa3.setText("0");
  faa4.setText("0");
  faa5.setText("0");
  faa6.setText("0");
  faa7.setText("");
  faa8.setText("0");
  faa11.setText("1");
  faa12.setText("1");

  list2.setBounds(840, 10, 120, 430);
  panel2.add(list2);
  list2.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list2.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (当前列号) {
     case 1:
      faa1.setText(list2.getSelectedItem());
      字段序号 = list2.getSelectedIndex();
      if ((",ntext,text,memo,image,long,lob,blob,clob,ole,varbinary,varchar,nvarchar,xml"
        .lastIndexOf("," + 列数据类型[字段序号])) < 0) {
       if (列数据宽度[字段序号] > 列名1[字段序号].length())
        faa2.setText("" + 列数据宽度[字段序号]);
       else
        faa2.setText("" + 列名1[字段序号].length());
       faa3.setText("1");
      }
      faa5.setText("宋体");
      faa6.setText("12");
      faa7.setText("有");
      faa8.setText("有");
      break;
     case 2:
      faa2.setText(list2.getSelectedItem());
      break;
     case 3:
      faa3.setText(list2.getSelectedItem());
      break;
     case 4:
      faa4.setText(list2.getSelectedItem());
      break;
     case 5:
      faa5.setText(list2.getSelectedItem());
      break;
     case 6:
      faa6.setText(list2.getSelectedItem());
      break;
     case 7:
      faa7.setText(list2.getSelectedItem());
      break;
     case 8:
      faa8.setText(list2.getSelectedItem());
      break;
     case 11:
      faa11.setText(list2.getSelectedItem());
      break;
     case 12:
      faa12.setText(list2.getSelectedItem());
      break;
     }
    }
   }
  });

  表格2.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int 选中行号 = 表格2.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (表格模型2.getValueAt(选中行号, j) != null)
      当前值 = 表格模型2.getValueAt(选中行号, j).toString();
     else
      当前值 = "";
     switch (j) {
     case 0:
      faa1.setText(当前值.toString());
      break;
     case 1:
      faa11.setText(当前值.toString());
      break;
     case 2:
      faa12.setText(当前值.toString());
      break;
     case 3:
      faa2.setText(当前值.toString());
      break;
     case 4:
      faa3.setText(当前值.toString());
      break;
     case 5:
      faa4.setText(当前值.toString());
      break;
     case 6:
      faa5.setText(当前值.toString());
      break;
     case 7:
      faa6.setText(当前值.toString());
      break;
     case 8:
      faa7.setText(当前值.toString());
      break;
     case 9:
      faa8.setText(当前值.toString());
      break;
     }
    }
   }
  });

  final JButton addButton1 = new JButton("添加到表格中");
  addButton1.setBounds(50, 540, 170, 20);
  addButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < 表格模型2.getRowCount(); i++) {
     if ((表格模型2.getValueAt(i, 0) != null)
       && (表格模型2.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(faa1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 < 0) {
     String[] rowValues = { faa1.getText(), faa11.getText(),
       faa12.getText(), faa2.getText(), faa3.getText(),
       faa4.getText(), faa5.getText(), faa6.getText(),
       faa7.getText(), faa8.getText() };
     表格模型2.addRow(rowValues);
     int rowCount = 表格2.getRowCount() + 1;
     faa1.setText("");
     faa2.setText("0");
     faa3.setText("0");
     faa4.setText("0");
     faa5.setText("0");
     faa6.setText("0");
     faa7.setText("");
     faa8.setText("0");
     faa11.setText("1");
     faa12.setText("1");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel2.add(addButton1);

  final JButton updButton1 = new JButton("修改表格数据");
  updButton1.setBounds(220, 540, 170, 20);
  updButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1;
    for (int i = 0; i < 表格模型2.getRowCount(); i++) {
     if ((表格模型2.getValueAt(i, 0) != null)
       && (表格模型2.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(faa1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 >= 0) {
     表格模型2.setValueAt(faa1.getText(), 选中行号, 0);
     表格模型2.setValueAt(faa11.getText(), 选中行号, 1);
     表格模型2.setValueAt(faa12.getText(), 选中行号, 2);
     表格模型2.setValueAt(faa2.getText(), 选中行号, 3);
     表格模型2.setValueAt(faa3.getText(), 选中行号, 4);
     表格模型2.setValueAt(faa4.getText(), 选中行号, 5);
     表格模型2.setValueAt(faa5.getText(), 选中行号, 6);
     表格模型2.setValueAt(faa6.getText(), 选中行号, 7);
     表格模型2.setValueAt(faa7.getText(), 选中行号, 8);
     表格模型2.setValueAt(faa8.getText(), 选中行号, 9);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel2.add(updButton1);

  final JButton delButton1 = new JButton("从表格中删除");
  delButton1.setBounds(390, 540, 170, 20);
  delButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = 表格2.getSelectedRow();
    if (选中行号 != -1)
     表格模型2.removeRow(选中行号);
   }
  });
  panel2.add(delButton1);

  final JButton countButton1 = new JButton("辅助计算");
  countButton1.setBounds(560, 540, 170, 20);
  countButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 数据条数 = 表格模型2.getRowCount();
    String[][] 数据 = new String[数据条数][11];
    int[][] 数据1 = new int[数据条数][11];
    for (int i = 0; i < 数据条数; i++) {
     for (int j = 0; j < 10; j++)
      数据[i][j] = 表格模型2.getValueAt(i, j).toString().trim();
     for (int j = 3; j < 8; j++) {
      if (j != 6) {
       if (数据[i][j].length() > 0)
        数据1[i][j] = Integer.valueOf(数据[i][j]);
       else
        数据1[i][j] = 0;
      }
     }
     for (int j = 3; j < 6; j++) {
      if (j == 4)
       数据1[i][j] = (int) (数据1[i][j] * 数据1[i][7] * 1.3);
      else
       数据1[i][j] = 数据1[i][j] * 数据1[i][7];
      数据[i][j] = "" + 数据1[i][j];
     }
    }
    表格模型2.setRowCount(0);
    for (int i = 0; i < 数据条数; i++)
     表格模型2.addRow(数据[i]);
   }
  });
  panel2.add(countButton1);

  final JButton clearButton1 = new JButton("清参数文本框");
  clearButton1.setBounds(730, 540, 170, 20);
  clearButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    faa1.setText("");
    faa2.setText("0");
    faa3.setText("0");
    faa4.setText("0");
    faa5.setText("0");
    faa6.setText("0");
    faa7.setText("");
    faa8.setText("0");
    faa11.setText("1");
    faa12.setText("1");
   }
  });
  panel2.add(clearButton1);

  flb1 = new JLabel("字段名称");
  flb1.setBounds(10, 460, 60, 20);
  panel3.add(flb1);
  fab1 = new JTextField("", 20);
  fab1.setBounds(70, 460, 100, 20);
  panel3.add(fab1);
  fab1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 1;
    list3.removeAll();
    for (int i = 0; i < 列数; i++) {
     list3.add(列名1[i]);
    }
   }
  });

  flb2 = new JLabel("宽度");
  flb2.setBounds(170, 460, 40, 20);
  panel3.add(flb2);
  fab2 = new JTextField("", 20);
  fab2.setBounds(210, 460, 60, 20);
  panel3.add(fab2);
  fab2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 2;
    list3.removeAll();
   }
  });

  flb3 = new JLabel("每行高度");
  flb3.setBounds(270, 460, 60, 20);
  panel3.add(flb3);
  fab3 = new JTextField("", 20);
  fab3.setBounds(330, 460, 60, 20);
  panel3.add(fab3);
  fab3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 3;
    list3.removeAll();
   }
  });

  flb4 = new JLabel("字体");
  flb4.setBounds(390, 460, 40, 20);
  panel3.add(flb4);
  fab4 = new JTextField("", 20);
  fab4.setBounds(430, 460, 100, 20);
  panel3.add(fab4);
  fab4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 4;
    list3.removeAll();
    for (int i = 0; i < 字体.length; i++) {
     list3.add(字体[i]);
    }
   }
  });

  flb5 = new JLabel("字号");
  panel3.add(flb5);
  fab5 = new JTextField("", 20);
  panel3.add(fab5);
  flb5.setBounds(530, 460, 40, 20);
  fab5.setBounds(570, 460, 60, 20);
  fab5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 5;
    list3.removeAll();
    for (int i = 0; i < 字号.length; i++) {
     list3.add(字号[i]);
    }
   }
  });

  flb6 = new JLabel("有无下表格线");
  panel3.add(flb6);
  fab6 = new JTextField("", 20);
  panel3.add(fab6);
  flb6.setBounds(630, 460, 80, 20);
  fab6.setBounds(710, 460, 60, 20);
  fab6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 6;
    list3.removeAll();
    list3.add("有");
    list3.add("无");
   }
  });

  flb7 = new JLabel("有无右表格线");
  panel3.add(flb7);
  fab7 = new JTextField("", 20);
  panel3.add(fab7);
  flb7.setBounds(770, 460, 80, 20);
  fab7.setBounds(850, 460, 60, 20);
  fab7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 7;
    list3.removeAll();
    list3.add("有");
    list3.add("无");
   }
  });

  list3.setBounds(840, 10, 120, 430);
  panel3.add(list3);
  list3.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list3.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (当前列号) {
     case 1:
      fab1.setText(list3.getSelectedItem());
      字段序号 = list3.getSelectedIndex();
      if ((",ntext,text,memo,image,long,lob,blob,clob,ole,varbinary,varchar,nvarchar,xml"
        .lastIndexOf("," + 列数据类型[字段序号])) < 0) {
       if (列数据宽度[字段序号] > 列名1[字段序号].length())
        fab2.setText("" + 列数据宽度[字段序号]);
       else
        fab2.setText("" + 列名1[字段序号].length());
      }
      fab3.setText("1");
      fab4.setText("宋体");
      fab5.setText("12");
      fab6.setText("有");
      fab7.setText("有");
      break;
     case 2:
      fab2.setText(list3.getSelectedItem());
      break;
     case 3:
      fab3.setText(list3.getSelectedItem());
      break;
     case 4:
      fab4.setText(list3.getSelectedItem());
      break;
     case 5:
      fab5.setText(list3.getSelectedItem());
      break;
     case 6:
      fab6.setText(list3.getSelectedItem());
      break;
     case 7:
      fab7.setText(list3.getSelectedItem());
      break;
     }
    }
   }
  });

  表格3.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int 选中行号 = 表格3.getSelectedRow();
    for (int j = 0; j < 7; j++) {
     if (表格模型3.getValueAt(选中行号, j) != null)
      当前值 = 表格模型3.getValueAt(选中行号, j).toString();
     else
      当前值 = "";
     switch (j) {
     case 0:
      fab1.setText(当前值.toString());
      break;
     case 1:
      fab2.setText(当前值.toString());
      break;
     case 2:
      fab3.setText(当前值.toString());
      break;
     case 3:
      fab4.setText(当前值.toString());
      break;
     case 4:
      fab5.setText(当前值.toString());
      break;
     case 5:
      fab6.setText(当前值.toString());
      break;
     case 6:
      fab7.setText(当前值.toString());
      break;
     }
    }
   }
  });

  final JButton addButton2 = new JButton("添加到表格中");
  addButton2.setBounds(50, 540, 170, 20);
  addButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < 表格模型3.getRowCount(); i++) {
     if ((表格模型3.getValueAt(i, 0) != null)
       && (表格模型3.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fab1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 < 0) {
     String[] rowValues = { fab1.getText(), fab2.getText(),
       fab3.getText(), fab4.getText(), fab5.getText(),
       fab6.getText(), fab7.getText() };
     表格模型3.addRow(rowValues);
     int rowCount = 表格3.getRowCount() + 1;
     fab1.setText("");
     fab2.setText("0");
     fab3.setText("1");
     fab4.setText("宋体");
     fab5.setText("0");
     fab6.setText("有");
     fab7.setText("有");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel3.add(addButton2);

  final JButton updButton2 = new JButton("修改表格数据");
  updButton2.setBounds(220, 540, 170, 20);
  updButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1;
    for (int i = 0; i < 表格模型3.getRowCount(); i++) {
     if ((表格模型3.getValueAt(i, 0) != null)
       && (表格模型3.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fab1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 >= 0) {
     表格模型3.setValueAt(fab1.getText(), 选中行号, 0);
     表格模型3.setValueAt(fab2.getText(), 选中行号, 1);
     表格模型3.setValueAt(fab3.getText(), 选中行号, 2);
     表格模型3.setValueAt(fab4.getText(), 选中行号, 3);
     表格模型3.setValueAt(fab5.getText(), 选中行号, 4);
     表格模型3.setValueAt(fab6.getText(), 选中行号, 5);
     表格模型3.setValueAt(fab7.getText(), 选中行号, 6);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel3.add(updButton2);

  final JButton delButton2 = new JButton("从表格中删除");
  delButton2.setBounds(390, 540, 170, 20);
  delButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = 表格3.getSelectedRow();
    if (选中行号 != -1)
     表格模型3.removeRow(选中行号);
   }
  });
  panel3.add(delButton2);

  final JButton countButton2 = new JButton("辅助计算");
  countButton2.setBounds(560, 540, 170, 20);
  countButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 数据条数 = 表格模型3.getRowCount();
    String[][] 数据 = new String[数据条数][11];
    int[][] 数据1 = new int[数据条数][11];
    for (int i = 0; i < 数据条数; i++) {
     for (int j = 0; j < 7; j++) {
      数据[i][j] = 表格模型3.getValueAt(i, j).toString().trim();
     }
     for (int j = 1; j < 5; j++) {
      if (j != 3) {
       if (数据[i][j].length() > 0)
        数据1[i][j] = Integer.valueOf(数据[i][j]);
       else
        数据1[i][j] = 0;
      }
     }
     数据1[i][1] = 数据1[i][1] * 数据1[i][4];
     数据[i][1] = "" + 数据1[i][1];
     数据1[i][2] = 数据1[i][2] * 数据1[i][4];
     数据[i][2] = "" + 数据1[i][2];
    }

    表格模型3.setRowCount(0);
    for (int i = 0; i < 数据条数; i++)
     表格模型3.addRow(数据[i]);
   }
  });
  panel3.add(countButton2);

  final JButton clearButton2 = new JButton("清参数文本框");
  clearButton2.setBounds(730, 540, 170, 20);
  clearButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fab1.setText("");
    fab2.setText("0");
    fab3.setText("1");
    fab4.setText("宋体");
    fab5.setText("0");
    fab6.setText("有");
    fab7.setText("有");
   }
  });
  panel3.add(clearButton2);

  flc1 = new JLabel("内容");
  flc1.setBounds(70, 360, 40, 20);
  panel4.add(flc1);
  fac1 = new JTextField("", 20);
  fac1.setBounds(110, 360, 100, 20);
  panel4.add(fac1);
  fac1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 1;
    list4.removeAll();
   }
  });

  flc2 = new JLabel("变量名");
  flc2.setBounds(230, 360, 50, 20);
  panel4.add(flc2);
  fac2 = new JTextField("", 20);
  fac2.setBounds(280, 360, 60, 20);
  panel4.add(fac2);
  fac2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 2;
    list4.removeAll();
   }
  });

  flc11 = new JLabel("行号");
  flc11.setBounds(370, 360, 40, 20);
  panel4.add(flc11);
  fac11 = new JTextField("", 20);
  fac11.setBounds(410, 360, 60, 20);
  panel4.add(fac11);
  fac11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 11;
    list4.removeAll();
   }
  });

  flc12 = new JLabel("列号");
  flc12.setBounds(500, 360, 40, 20);
  panel4.add(flc12);
  fac12 = new JTextField("", 20);
  fac12.setBounds(540, 360, 60, 20);
  panel4.add(fac12);
  fac12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 12;
    list4.removeAll();
   }
  });

  flc3 = new JLabel("宽度");
  flc3.setBounds(630, 360, 40, 20);
  panel4.add(flc3);
  fac3 = new JTextField("", 20);
  fac3.setBounds(670, 360, 60, 20);
  panel4.add(fac3);
  fac3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 3;
    list4.removeAll();
   }
  });

  flc4 = new JLabel("高度");
  flc4.setBounds(760, 360, 40, 20);
  panel4.add(flc4);
  fac4 = new JTextField("", 20);
  fac4.setBounds(800, 360, 60, 20);
  panel4.add(fac4);
  fac4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 4;
    list4.removeAll();
   }
  });

  flc5 = new JLabel("左边距");
  flc5.setBounds(60, 400, 50, 20);
  panel4.add(flc5);
  fac5 = new JTextField("", 20);
  fac5.setBounds(110, 400, 100, 20);
  panel4.add(fac5);
  fac5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 5;
    list4.removeAll();
   }
  });

  flc6 = new JLabel("到顶距");
  panel4.add(flc6);
  fac6 = new JTextField("", 20);
  panel4.add(fac6);
  flc6.setBounds(220, 400, 60, 20);
  fac6.setBounds(280, 400, 60, 20);
  fac6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 6;
    list4.removeAll();
   }
  });

  flc7 = new JLabel("字体");
  panel4.add(flc7);
  fac7 = new JTextField("", 20);
  panel4.add(fac7);
  flc7.setBounds(370, 400, 40, 20);
  fac7.setBounds(410, 400, 120, 20);
  fac7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 7;
    list4.removeAll();
    for (int i = 0; i < 字体.length; i++) {
     list4.add(字体[i]);
    }
   }
  });

  flc8 = new JLabel("字号");
  panel4.add(flc8);
  fac8 = new JTextField("", 20);
  panel4.add(fac8);
  flc8.setBounds(560, 400, 40, 20);
  fac8.setBounds(600, 400, 100, 20);
  fac8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 8;
    list4.removeAll();
    for (int i = 0; i < 字号.length; i++) {
     list4.add(字号[i]);
    }
   }
  });

  list4.setBounds(840, 10, 120, 330);
  panel4.add(list4);
  list4.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list4.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (当前列号) {
     case 1:
      fac1.setText(list4.getSelectedItem());
      break;
     case 2:
      fac2.setText(list4.getSelectedItem());
      break;
     case 3:
      fac3.setText(list4.getSelectedItem());
      break;
     case 4:
      fac4.setText(list4.getSelectedItem());
      break;
     case 5:
      fac5.setText(list4.getSelectedItem());
      break;
     case 6:
      fac6.setText(list4.getSelectedItem());
      break;
     case 7:
      fac7.setText(list4.getSelectedItem());
      break;
     case 8:
      fac8.setText(list4.getSelectedItem());
      break;
     case 11:
      fac11.setText(list4.getSelectedItem());
      break;
     case 12:
      fac12.setText(list4.getSelectedItem());
      break;
     }
    }
   }
  });

  表格4.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int 选中行号 = 表格4.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (表格模型4.getValueAt(选中行号, j) != null)
      当前值 = 表格模型4.getValueAt(选中行号, j).toString();
     else
      当前值 = "";
     switch (j) {
     case 0:
      fac1.setText(当前值.toString());
      break;
     case 1:
      fac2.setText(当前值.toString());
      break;
     case 2:
      fac11.setText(当前值.toString());
      break;
     case 3:
      fac12.setText(当前值.toString());
      break;
     case 4:
      fac3.setText(当前值.toString());
      break;
     case 5:
      fac4.setText(当前值.toString());
      break;
     case 6:
      fac5.setText(当前值.toString());
      break;
     case 7:
      fac6.setText(当前值.toString());
      break;
     case 8:
      fac7.setText(当前值.toString());
      break;
     case 9:
      fac8.setText(当前值.toString());
      break;
     case 10:
      fac9.setText(当前值.toString());
      break;
     }
    }
   }
  });

  final JButton addButton4 = new JButton("添加到表格中");
  addButton4.setBounds(50, 440, 170, 20);
  addButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {

    int 选中行号 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < 表格模型4.getRowCount(); i++) {
     if ((表格模型4.getValueAt(i, 0) != null)
       && (表格模型4.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fac1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 < 0) {
     String[] rowValues = { fac1.getText(), fac2.getText(),
       fac11.getText(), fac12.getText(), fac3.getText(),
       fac4.getText(), fac5.getText(), fac6.getText(),
       fac7.getText(), fac8.getText() };
     表格模型4.addRow(rowValues);
     int rowCount = 表格4.getRowCount() + 1;
     fac1.setText("");
     fac2.setText("0");
     fac3.setText("0");
     fac4.setText("0");
     fac5.setText("0");
     fac6.setText("0");
     fac7.setText("");
     fac8.setText("0");
     fac11.setText("0");
     fac12.setText("0");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel4.add(addButton4);

  final JButton updButton4 = new JButton("修改表格数据");
  updButton4.setBounds(220, 440, 170, 20);
  updButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1;
    for (int i = 0; i < 表格模型4.getRowCount(); i++) {
     if ((表格模型4.getValueAt(i, 0) != null)
       && (表格模型4.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fac1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 >= 0) {
     表格模型4.setValueAt(fac1.getText(), 选中行号, 0);
     表格模型4.setValueAt(fac2.getText(), 选中行号, 1);
     表格模型4.setValueAt(fac11.getText(), 选中行号, 2);
     表格模型4.setValueAt(fac12.getText(), 选中行号, 3);
     表格模型4.setValueAt(fac3.getText(), 选中行号, 4);
     表格模型4.setValueAt(fac4.getText(), 选中行号, 5);
     表格模型4.setValueAt(fac5.getText(), 选中行号, 6);
     表格模型4.setValueAt(fac6.getText(), 选中行号, 7);
     表格模型4.setValueAt(fac7.getText(), 选中行号, 8);
     表格模型4.setValueAt(fac8.getText(), 选中行号, 9);
     表格模型4.setValueAt(fac9.getText(), 选中行号, 10);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel4.add(updButton4);

  final JButton delButton4 = new JButton("从表格中删除");
  delButton4.setBounds(390, 440, 170, 20);
  delButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = 表格4.getSelectedRow();
    if (选中行号 != -1)
     表格模型4.removeRow(选中行号);
   }
  });
  panel4.add(delButton4);

  final JButton countButton4 = new JButton("辅助计算");
  countButton4.setBounds(560, 440, 170, 20);
  countButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 数据条数 = 表格模型4.getRowCount();
    String[][] 数据 = new String[数据条数][11];
    int[][] 数据1 = new int[数据条数][11];
    for (int i = 0; i < 数据条数; i++) {
     for (int j = 0; j < 10; j++)
      数据[i][j] = 表格模型4.getValueAt(i, j).toString().trim();
     for (int j = 4; j < 10; j++) {
      if (j != 8) {
       if (数据[i][j].length() > 0)
        数据1[i][j] = Integer.valueOf(数据[i][j]);
       else
        数据1[i][j] = 0;
      }
     }
     for (int j = 4; j < 8; j++) {
      if (j != 5)
       数据1[i][j] = 数据1[i][j] * 数据1[i][9];
      else
       数据1[i][j] = (int) (数据1[i][j] * 数据1[i][9] * 1.3); // 高度
      数据[i][j] = "" + 数据1[i][j];
     }
    }
    // 更新表格数据
    表格模型4.setRowCount(0);
    for (int i = 0; i < 数据条数; i++)
     表格模型4.addRow(数据[i]);
   }
  });
  panel4.add(countButton4);

  final JButton clearButton4 = new JButton("清参数文本框");
  clearButton4.setBounds(730, 440, 170, 20);
  clearButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fac1.setText("");
    fac2.setText("0");
    fac3.setText("0");
    fac4.setText("0");
    fac5.setText("0");
    fac6.setText("0");
    fac7.setText("");
    fac8.setText("0");
    fac9.setText("");
    fac11.setText("0");
    fac12.setText("0");
   }
  });
  panel4.add(clearButton4);

  /* 表尾页 */
  fld1 = new JLabel("内容");
  fld1.setBounds(70, 360, 40, 20);
  panel5.add(fld1);
  fad1 = new JTextField("", 20);
  fad1.setBounds(110, 360, 100, 20);
  panel5.add(fad1);
  fad1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 1;
    list5.removeAll();
   }
  });

  fld2 = new JLabel("变量名");
  fld2.setBounds(230, 360, 50, 20);
  panel5.add(fld2);
  fad2 = new JTextField("", 20);
  fad2.setBounds(280, 360, 60, 20);
  panel5.add(fad2);
  fad2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 2;
    list5.removeAll();
   }
  });

  fld11 = new JLabel("行号");
  fld11.setBounds(370, 360, 40, 20);
  panel5.add(fld11);
  fad11 = new JTextField("", 20);
  fad11.setBounds(410, 360, 60, 20);
  panel5.add(fad11);
  fad11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 11;
    list5.removeAll();
   }
  });

  fld12 = new JLabel("列号");
  fld12.setBounds(500, 360, 40, 20);
  panel5.add(fld12);
  fad12 = new JTextField("", 20);
  fad12.setBounds(540, 360, 60, 20);
  panel5.add(fad12);
  fad12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 12;
    list5.removeAll();
   }
  });

  fld3 = new JLabel("宽度");
  fld3.setBounds(630, 360, 40, 20);
  panel5.add(fld3);
  fad3 = new JTextField("", 20);
  fad3.setBounds(670, 360, 60, 20);
  panel5.add(fad3);
  fad3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 3;
    list5.removeAll();
   }
  });

  fld4 = new JLabel("高度");
  fld4.setBounds(760, 360, 40, 20);
  panel5.add(fld4);
  fad4 = new JTextField("", 20);
  fad4.setBounds(800, 360, 60, 20);
  panel5.add(fad4);
  fad4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 4;
    list5.removeAll();
   }
  });

  fld5 = new JLabel("左边距");
  fld5.setBounds(60, 400, 50, 20);
  panel5.add(fld5);
  fad5 = new JTextField("", 20);
  fad5.setBounds(110, 400, 100, 20);
  panel5.add(fad5);
  fad5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 5;
    list5.removeAll();
   }
  });

  fld6 = new JLabel("到顶距");
  panel5.add(fld6);
  fad6 = new JTextField("", 20);
  panel5.add(fad6);
  fld6.setBounds(220, 400, 60, 20);
  fad6.setBounds(280, 400, 60, 20);
  fad6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 6;
    list5.removeAll();
   }
  });

  fld7 = new JLabel("字体");
  panel5.add(fld7);
  fad7 = new JTextField("", 20);
  panel5.add(fad7);
  fld7.setBounds(370, 400, 40, 20);
  fad7.setBounds(410, 400, 120, 20);
  fad7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 7;
    list5.removeAll();
    for (int i = 0; i < 字体.length; i++) {
     list5.add(字体[i]);
    }
   }
  });

  fld8 = new JLabel("字号");
  panel5.add(fld8);
  fad8 = new JTextField("", 20);
  panel5.add(fad8);
  fld8.setBounds(560, 400, 40, 20);
  fad8.setBounds(600, 400, 100, 20);
  fad8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    当前列号 = 8;
    list5.removeAll();
    for (int i = 0; i < 字号.length; i++) {
     list5.add(字号[i]);
    }
   }
  });

  list5.setBounds(840, 10, 170, 330);
  panel5.add(list5);
  list5.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list5.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (当前列号) {
     case 1:
      fad1.setText(list5.getSelectedItem());
      break;
     case 2:
      fad2.setText(list5.getSelectedItem());
      break;
     case 3:
      fad3.setText(list5.getSelectedItem());
      break;
     case 4:
      fad4.setText(list5.getSelectedItem());
      break;
     case 5:
      fad5.setText(list5.getSelectedItem());
      break;
     case 6:
      fad6.setText(list5.getSelectedItem());
      break;
     case 7:
      fad7.setText(list5.getSelectedItem());
      break;
     case 8:
      fad8.setText(list5.getSelectedItem());
      break;
     case 11:
      fad11.setText(list5.getSelectedItem());
      break;
     case 12:
      fad12.setText(list5.getSelectedItem());
      break;
     }
    }
   }
  });

  表格5.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int 选中行号 = 表格5.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (表格模型5.getValueAt(选中行号, j) != null)
      当前值 = 表格模型5.getValueAt(选中行号, j).toString();
     else
      当前值 = "";
     switch (j) {
     case 0:
      fad1.setText(当前值.toString());
      break;
     case 1:
      fad2.setText(当前值.toString());
      break;
     case 2:
      fad11.setText(当前值.toString());
      break;
     case 3:
      fad12.setText(当前值.toString());
      break;
     case 4:
      fad3.setText(当前值.toString());
      break;
     case 5:
      fad4.setText(当前值.toString());
      break;
     case 6:
      fad5.setText(当前值.toString());
      break;
     case 7:
      fad6.setText(当前值.toString());
      break;
     case 8:
      fad7.setText(当前值.toString());
      break;
     case 9:
      fad8.setText(当前值.toString());
      break;
     case 10:
      fad9.setText(当前值.toString());
      break;
     }
    }
   }
  });

  final JButton addButton5 = new JButton("添加到表格中");
  addButton5.setBounds(50, 440, 170, 20);
  addButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < 表格模型5.getRowCount(); i++) {
     if ((表格模型5.getValueAt(i, 0) != null)
       && (表格模型5.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fad1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 < 0) {
     String[] rowValues = { fad1.getText(), fad2.getText(),
       fad11.getText(), fad12.getText(), fad3.getText(),
       fad4.getText(), fad5.getText(), fad6.getText(),
       fad7.getText(), fad8.getText() };
     表格模型5.addRow(rowValues);
     int rowCount = 表格5.getRowCount() + 1;
     fad1.setText("");
     fad2.setText("0");
     fad3.setText("0");
     fad4.setText("0");
     fad5.setText("0");
     fad6.setText("0");
     fad7.setText("");
     fad8.setText("0");
     fad11.setText("0");
     fad12.setText("0");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel5.add(addButton5);

  final JButton updButton5 = new JButton("修改表格数据");
  updButton5.setBounds(220, 440, 170, 20);
  updButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = -1;
    for (int i = 0; i < 表格模型5.getRowCount(); i++) {
     if ((表格模型5.getValueAt(i, 0) != null)
       && (表格模型5.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fad1.getText().trim()))) {
      选中行号 = i;
      break;
     }
    }
    if (选中行号 >= 0) {
     表格模型5.setValueAt(fad1.getText(), 选中行号, 0);
     表格模型5.setValueAt(fad2.getText(), 选中行号, 1);
     表格模型5.setValueAt(fad11.getText(), 选中行号, 2);
     表格模型5.setValueAt(fad12.getText(), 选中行号, 3);
     表格模型5.setValueAt(fad3.getText(), 选中行号, 4);
     表格模型5.setValueAt(fad4.getText(), 选中行号, 5);
     表格模型5.setValueAt(fad5.getText(), 选中行号, 6);
     表格模型5.setValueAt(fad6.getText(), 选中行号, 7);
     表格模型5.setValueAt(fad7.getText(), 选中行号, 8);
     表格模型5.setValueAt(fad8.getText(), 选中行号, 9);
     表格模型5.setValueAt(fad9.getText(), 选中行号, 10);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel5.add(updButton5);

  final JButton delButton5 = new JButton("从表格中删除");
  delButton5.setBounds(390, 440, 170, 20);
  delButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 选中行号 = 表格5.getSelectedRow();
    if (选中行号 != -1)
     表格模型5.removeRow(选中行号);
   }
  });
  panel5.add(delButton5);

  final JButton countButton5 = new JButton("辅助计算");
  countButton5.setBounds(560, 440, 170, 20);
  countButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int 数据条数 = 表格模型5.getRowCount();
    String[][] 数据 = new String[数据条数][11];
    int[][] 数据1 = new int[数据条数][11];
    for (int i = 0; i < 数据条数; i++) {
     for (int j = 0; j < 10; j++)
      数据[i][j] = 表格模型5.getValueAt(i, j).toString().trim();
     for (int j = 4; j < 10; j++) {
      if (j != 8) {
       if (数据[i][j].length() > 0)
        数据1[i][j] = Integer.valueOf(数据[i][j]);
       else
        数据1[i][j] = 0;
      }
     }
     for (int j = 4; j < 8; j++) {
      if (j != 5)
       数据1[i][j] = 数据1[i][j] * 数据1[i][9];
      else
       数据1[i][j] = (int) (数据1[i][j] * 数据1[i][9] * 1.12);
      数据[i][j] = "" + 数据1[i][j];
     }
    }

    表格模型5.setRowCount(0);
    for (int i = 0; i < 数据条数; i++)
     表格模型5.addRow(数据[i]);
   }
  });
  panel5.add(countButton5);

  final JButton clearButton5 = new JButton("清参数文本框");
  clearButton5.setBounds(730, 440, 170, 20);
  clearButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fad1.setText("");
    fad2.setText("0");
    fad3.setText("0");
    fad4.setText("0");
    fad5.setText("0");
    fad6.setText("0");
    fad7.setText("");
    fad8.setText("0");
    fad9.setText("");
    fad11.setText("0");
    fad12.setText("0");
   }
  });
  panel5.add(clearButton5);

  frame5.add(panel5);
  frame4.add(panel4);
  frame3.add(panel3);
  frame2.add(panel2);
  frame1.add(panel1);
  frame5.setVisible(true); // 安装窗口
  frame4.setVisible(true);
  frame3.setVisible(true);
  frame2.setVisible(true);
  frame1.setVisible(true);
 }
}

16.源码16,部件程序:表格式报表打印预览
/*
 * 程序文件名:dataPreview1.java
 * 作者:程传庆
 * 程序功能:根据打印格式文件内容打印预览所传入的表格数据报表。
 * 属于单数据表的表格式报表打印预览。
 * 要求先利用程序printFormat1.java生成格式文件。
 * 在上级程序中生成表格数据,
 * 通过String[][] 表格数据,传入打印内容
 * 通过String 格式文件名,说明打印格式文件的名称。
 * 再根据格式文件预览打印结构与内容。
 * 注意格式文件中关于表头、数据内容等的描述要和打印格式文件一致。
 * 包括字段名称、顺序、类型都必须一致。
 * 调用命令:dataPreview1.printView1(表格数据,格式文件名);
 */
import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;

public class dataPreview1 extends JComponent {
 private static JFrame frame1;
 private static String 接口文件名;
 private static String s1 = "", s2 = "";
 private static int 记录条数 = 0, 列数 = 0;
 private static int[] 列数据宽度;
 private static String[][] 表格数据;
 private static ArrayList<struct1> title = new ArrayList<struct1>();
 private static ArrayList<struct2> tableTitle = new ArrayList<struct2>();
 private static ArrayList<struct3> table1 = new ArrayList<struct3>();
 private static ArrayList<struct4> table2 = new ArrayList<struct4>();
 private static ArrayList<struct5> table3 = new ArrayList<struct5>();
 private static int 页高 = 600;
 private static int x1 = 0, y1 = 0, w1 = 0, h1 = 0, 左边 = 0, 到顶 = 0;
 private static Graphics2D g3;
 private static Graphics g;

 static void title() {
  struct2[] 标签 = new struct2[tableTitle.size()];
  左边 = Integer.valueOf(tableTitle.get(0).tableTitle[3]);
  左边 = 左边 / 2;
  for (int i = 0; i < tableTitle.size(); i++)
   标签[i] = tableTitle.get(i);
  g3.setFont(new Font(标签[0].tableTitle[6], Font.PLAIN, Integer
    .valueOf(标签[0].tableTitle[7])));// 设置字体
  for (int i = 0; i < tableTitle.size(); i++) {
   x1 = 左边;
   y1 = 到顶;
   w1 = Integer.valueOf(标签[i].tableTitle[3]);
   h1 = Integer.valueOf(标签[i].tableTitle[4]);
   g3.drawLine(x1, y1, x1 + w1, y1);
   g3.drawLine(x1, y1, x1, y1 + h1);
   g3.drawString(标签[i].tableTitle[0], 左边 + 2, 到顶 + h1);
   if (标签[i].tableTitle[8].equals("有"))
    g3.drawLine(x1, y1 + h1, x1 + w1, y1 + h1);
   if (标签[i].tableTitle[9].equals("有"))
    g3.drawLine(x1 + w1, y1, x1 + w1, y1 + h1);
   左边 = 左边 + w1;
   if ((i < tableTitle.size() - 1)
     && (Integer.valueOf(标签[i].tableTitle[1]) < Integer
       .valueOf(标签[i + 1].tableTitle[1])))
    到顶 = 到顶 + h1;
  }
  到顶 = 到顶 + h1;
 }

 protected void paintComponent(Graphics g1) {
  g = g1;
  g3 = (Graphics2D) g;
  struct1[] 标题 = new struct1[title.size()];
  到顶 = 0;
  左边 = 0;
  for (int i = 0; i < title.size(); i++) {
   标题[i] = title.get(i);
   g3.setFont(new Font(标题[i].title[8], Font.PLAIN, Integer
     .valueOf(标题[i].title[9])));// 设置字体
   x1 = Integer.valueOf(标题[i].title[6]); // [6]
   y1 = Integer.valueOf(标题[i].title[7]); // [7]
   g3.drawString(标题[i].title[0], x1, y1);
   到顶 = y1 + Integer.valueOf(标题[i].title[5]);
  }
  title();
  struct3[] 表体 = new struct3[table1.size()];
  int[] w10 = new int[table1.size()];
  int[] h10 = new int[table1.size()];
  int[] h20 = new int[table1.size()];
  for (int i = 0; i < table1.size(); i++) {
   表体[i] = table1.get(i);
   w10[i] = Integer.valueOf(表体[i].table1[1]);
   h10[i] = Integer.valueOf(表体[i].table1[2]);
   h20[i] = Integer.valueOf(表体[i].table1[4]);
  }
  y1 = 到顶;
  g3.setFont(new Font(表体[0].table1[3], Font.PLAIN, Integer
    .valueOf(表体[0].table1[4])));// 设置字体
  for (int j = 0; j < 记录条数; j++) {
   x1 = Integer.valueOf(tableTitle.get(0).tableTitle[3]) / 2;
   g3.drawLine(x1, y1, x1, y1 + h1);
   for (int i = 0; i < table1.size(); i++) {
    if (表格数据[j][i] == null)
     表格数据[j][i] = " ";
    g3.drawString(表格数据[j][i], x1 + 2, y1 + h20[i]);
    if (表体[i].table1[5].equals("有"))
     g3.drawLine(x1, y1 + h10[i], x1 + w10[i], y1 + h10[i]);
    if (表体[i].table1[6].equals("有"))
     g3.drawLine(x1 + w10[i], y1, x1 + w10[i], y1 + h10[i]);
    x1 = x1 + w10[i];
   }
   y1 = y1 + h10[table1.size() - 1];
   if (y1 >= 页高) {
    struct4[] 页尾 = new struct4[table2.size()];
    for (int i1 = 0; i1 < table2.size(); i1++) {
     页尾[i1] = table2.get(i1);
     g3.setFont(new Font(页尾[i1].table2[8], Font.PLAIN, Integer
       .valueOf(页尾[i1].table2[9])));// 设置字体
     x1 = Integer.valueOf(页尾[i1].table2[6]);
     y1 = Integer.valueOf(页尾[i1].table2[7]);
     g3.drawString(页尾[i1].table2[0], x1, y1);
     到顶 = y1 + Integer.valueOf(页尾[i1].table2[5]);
    }
    y1 = 640;
    break;
   }
  }
  y1 = y1 + h10[table1.size() - 1];
  struct5[] 表尾 = new struct5[table3.size()];
  for (int i = 0; i < table3.size(); i++) {
   表尾[i] = table3.get(i);
   g3.setFont(new Font(表尾[i].table3[8], Font.PLAIN, Integer
     .valueOf(表尾[i].table3[9])));// 设置字体
   x1 = Integer.valueOf(表尾[i].table3[6]);
   y1 = y1 + Integer.valueOf(表尾[i].table3[5]) / 2;
   g3.drawString(表尾[i].table3[0], x1, y1);
  }
 }

 /** 主程序,创建界面 */
 static void printView1(String[][] 表格数据1, String 格式文件名) {
  s1 = "";
  s2 = "";
  记录条数 = 0;
  列数 = 0;
  title = new ArrayList<struct1>();
  tableTitle = new ArrayList<struct2>();
  table1 = new ArrayList<struct3>();
  table2 = new ArrayList<struct4>();
  table3 = new ArrayList<struct5>();
  页高 = 600;
  x1 = 0;
  y1 = 0;
  w1 = 0;
  h1 = 0;
  左边 = 0;
  到顶 = 0;
  接口文件名 = 格式文件名;
  frame1 = new JFrame("报表预览程序                          作者:程传庆");
  frame1.setBounds(10, 10, 1000, 1000);
  frame1.add(new dataPreview1());
  frame1.setVisible(true);
  File file1 = new File(接口文件名);
  try {
   if (file1.exists()) { // 如果文件存在
    FileReader fr = new FileReader(file1);// 读方式打开文件
    BufferedReader br = new BufferedReader(fr);// 建立文件输入字符流
    String tempStr = null;
    for (int i = 0; (tempStr = br.readLine()) != null; i++) {// 读文件
     if (tempStr.substring(0, 2).equals("1,")) {

      title.add(new struct1(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("2,")) {
      tableTitle.add(new struct2(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("3,")) {
      table1.add(new struct3(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("4,")) {
      table2.add(new struct4(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("5,")) {
      table3.add(new struct5(tempStr.substring(2,
        tempStr.length()).split("。")));
     }
    }
   }
  } catch (IOException e2) {
   JOptionPane.showMessageDialog(null, "打开文件错!");
  }
  String s3 = "";
  for (int i = 0; i < table1.size(); i++) {
   if (s3.length() == 0)
    s3 = table1.get(i).table1[0];
   else
    s3 = s3 + "," + table1.get(i).table1[0];
  }
  记录条数 = 表格数据1.length;
  列数 = 表格数据1[0].length;
  表格数据 = new String[记录条数][列数];
  for (int i = 0; i < 记录条数; i++) {
   for (int j = 0; j < 列数; j++)
    表格数据[i][j] = 表格数据1[i][j];
  }
 }
}


17.源码17.部件程序,表格式报表打印。
/*
 * 程序文件名:dataPrint1.java
 * 作者:程学先
 * 程序功能:根据打印格式文件内容打印预览所传入的表格数据报表。
 * 属于单数据表的表格式报表打印。
 * 要求先利用程序printFormat1.java生成格式文件。
 * 在上级程序中生成表格数据,
 * 通过String[][] 表格数据,传入打印内容
 * 通过String 格式文件名,说明打印格式文件的名称。
 * 就可根据格式文件打印报表。
 * 注意格式文件中关于表头、数据内容等的描述要和打印格式文件一致。
 * 包括字段名称、顺序、类型都必须一致。
 * 调用命令:dataPrint1.print1(表格数据1,格式文件名)
 */
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;

public class dataPrint1 extends JFrame {
 private static String 接口文件名;
 private static int 记录条数 = 0, 列数 = 0;
 private static String[][] 表格数据;
 private static ArrayList<struct1> title = new ArrayList<struct1>();
 private static ArrayList<struct2> tableTitle = new ArrayList<struct2>();
 private static ArrayList<struct3> table1 = new ArrayList<struct3>();
 private static ArrayList<struct4> table2 = new ArrayList<struct4>();
 private static ArrayList<struct5> table3 = new ArrayList<struct5>();
 private static int 页高 = 600;
 private static int x1 = 0, y1 = 0, w1 = 0, h1 = 0, 左边 = 0, 到顶 = 0;
 private PageFormat pf;
 private static Graphics2D g2;

 static void title() {
  struct2[] 标签 = new struct2[tableTitle.size()];
  左边 = Integer.valueOf(tableTitle.get(0).tableTitle[3]);
  左边 = 左边 / 2;
  for (int i = 0; i < tableTitle.size(); i++)
   标签[i] = tableTitle.get(i);
  g2.setFont(new Font(标签[0].tableTitle[6], Font.PLAIN, Integer
    .valueOf(标签[0].tableTitle[7])));
  for (int i = 0; i < tableTitle.size(); i++) {
   x1 = 左边;
   y1 = 到顶;
   w1 = Integer.valueOf(标签[i].tableTitle[3]);
   h1 = Integer.valueOf(标签[i].tableTitle[4]);
   g2.drawLine(x1, y1, x1 + w1, y1);
   g2.drawLine(x1, y1, x1, y1 + h1);
   g2.drawString(标签[i].tableTitle[0], 左边 + 2, 到顶 + h1);
   if (标签[i].tableTitle[8].equals("有"))
    g2.drawLine(x1, y1 + h1, x1 + w1, y1 + h1);
   if (标签[i].tableTitle[9].equals("有"))
    g2.drawLine(x1 + w1, y1, x1 + w1, y1 + h1);
   左边 = 左边 + w1;
   if ((i < tableTitle.size() - 1)
     && (Integer.valueOf(标签[i].tableTitle[1]) < Integer
       .valueOf(标签[i + 1].tableTitle[1])))
    到顶 = 到顶 + h1;
  }
  到顶 = 到顶 + h1;
 }

 public static void print1(String[][] 表格数据1, String 格式文件名) {
  记录条数 = 0;
  列数 = 0;
  title = new ArrayList<struct1>();
  tableTitle = new ArrayList<struct2>();
  table1 = new ArrayList<struct3>();
  table2 = new ArrayList<struct4>();
  table3 = new ArrayList<struct5>();
  页高 = 600;
  x1 = 0;
  y1 = 0;
  w1 = 0;
  h1 = 0;
  左边 = 0;
  到顶 = 0;
  接口文件名 = 格式文件名;
  dataPrint1 frame = new dataPrint1();
  frame.setTitle("报表打印程序                               作者:程学先");
  frame.pf = new PageFormat();
  frame.pf.setOrientation(PageFormat.LANDSCAPE);
  File file1 = new File(接口文件名);
  try {
   if (file1.exists()) {
    FileReader fr = new FileReader(file1);
    BufferedReader br = new BufferedReader(fr);
    String tempStr = null;
    for (int i = 0; (tempStr = br.readLine()) != null; i++) {
     if (tempStr.substring(0, 2).equals("1,")) {

      title.add(new struct1(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("2,")) {

      tableTitle.add(new struct2(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("3,")) {

      table1.add(new struct3(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("4,")) {

      table2.add(new struct4(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("5,")) {

      table3.add(new struct5(tempStr.substring(2,
        tempStr.length()).split("。")));
     }
    }

   }
  } catch (IOException e2) {
   JOptionPane.showMessageDialog(null, "打开文件错!");
  }
  String s3 = "";
  for (int i = 0; i < table1.size(); i++) {
   if (s3.length() == 0)
    s3 = table1.get(i).table1[0];
   else
    s3 = s3 + "," + table1.get(i).table1[0];
  }
  记录条数 = 表格数据1.length;
  列数 = 表格数据1[0].length;
  表格数据 = new String[记录条数][列数];
  for (int i = 0; i < 记录条数; i++) {
   for (int j = 0; j < 列数; j++)
    表格数据[i][j] = 表格数据1[i][j];
  }

  final PrinterJob job = PrinterJob.getPrinterJob();
  if (!job.printDialog())
   return;

  job.setPrintable(new Printable() {
   public int print(Graphics graphics, PageFormat pageFormat,
     int pageIndex) throws PrinterException {
    if (pageIndex < 1) {
     g2 = (Graphics2D) graphics;
     g2.setStroke(new BasicStroke(1f));
     struct1[] 标题 = new struct1[title.size()];
     到顶 = 0;
     左边 = 0;
     for (int i = 0; i < title.size(); i++) {
      标题[i] = title.get(i);
      g2.setFont(new Font(标题[i].title[8], Font.PLAIN, Integer
        .valueOf(标题[i].title[9])));
      x1 = Integer.valueOf(标题[i].title[6]);
      y1 = Integer.valueOf(标题[i].title[7]);
      g2.drawString(标题[i].title[0], x1, y1);
      到顶 = y1 + Integer.valueOf(标题[i].title[5]);
     }
     title();
     struct3[] 表体 = new struct3[table1.size()];
     int[] w10 = new int[table1.size()];
     int[] h10 = new int[table1.size()];
     int[] h20 = new int[table1.size()];
     for (int i = 0; i < table1.size(); i++) {
      表体[i] = table1.get(i);
      w10[i] = Integer.valueOf(表体[i].table1[1]);
      h10[i] = Integer.valueOf(表体[i].table1[2]);
      h20[i] = Integer.valueOf(表体[i].table1[4]);
     }
     y1 = 到顶;
     for (int j = 0; j < 记录条数; j++) {
      x1 = Integer.valueOf(tableTitle.get(0).tableTitle[3]) / 2;
      g2.drawLine(x1, y1, x1, y1 + h1);
      for (int i = 0; i < table1.size(); i++) {
       if (表格数据[j][i] == null)
        表格数据[j][i] = " ";
       g2.drawString(表格数据[j][i], x1 + 2, y1 + h20[i]);
       if (表体[i].table1[5].equals("有"))
        g2.drawLine(x1, y1 + h10[i], x1 + w10[i], y1
          + h10[i]);
       if (表体[i].table1[6].equals("有"))
        g2.drawLine(x1 + w10[i], y1, x1 + w10[i], y1
          + h10[i]);
       x1 = x1 + w10[i];
      }
      y1 = y1 + h10[table1.size() - 1];
      if (y1 >= 页高) {
       struct4[] 页尾 = new struct4[table2.size()];
       for (int i1 = 0; i1 < table2.size(); i1++) {
        页尾[i1] = table2.get(i1);
        g2.setFont(new Font(页尾[i1].table2[8],
          Font.PLAIN, Integer
            .valueOf(页尾[i1].table2[9])));
        x1 = Integer.valueOf(页尾[i1].table2[6]);
        y1 = Integer.valueOf(页尾[i1].table2[7]);
        g2.drawString(页尾[i1].table2[0], x1, y1);
        到顶 = y1 + Integer.valueOf(页尾[i1].table2[5]);
       }
       y1 = 640;
       break;
      }
     }
     y1 = y1 + h10[table1.size() - 1];
     struct5[] 表尾 = new struct5[table3.size()];
     for (int i = 0; i < table3.size(); i++) {
      表尾[i] = table3.get(i);
      g2.setFont(new Font(表尾[i].table3[8], Font.PLAIN,
        Integer.valueOf(表尾[i].table3[9])));
      x1 = Integer.valueOf(表尾[i].table3[6]);
      y1 = y1 + Integer.valueOf(表尾[i].table3[5]) / 2;
      g2.drawString(表尾[i].table3[0], x1, y1);
     }
     return Printable.PAGE_EXISTS;
    } else {
     return Printable.NO_SUCH_PAGE;
    }
   }
  });
  try {
   job.print();
  } catch (Exception e1) {
   e1.printStackTrace();
  }
  frame.dispose();
 }
}

18.源码18.部件程序,定查询条件表达式的多数据表单一条件或二条件查询程序,可变换标签,可分组统计,可按格式打印报表。
/**
 * 程序文件名:dataQuery9.java
 * 作者:程学先
 * 完成时间:2013年11月27日
 * 部件功能:在参数中直接给定查询条件表达式的主题部分和输出要求多表单条件或二条件查询程序,
 * 程序允许利用字典表做标签的变换。
 * 可按格式文件组织打印。运行时程序提供单个或二个文本框供输入查询数据,之后组织查询。
 * 被调用语句:datadataQuery9.means(parameter);由主程序调用。
 * 要求提供的参数:“表名集”、“条件表达式”。
 * 条件表达式可以由一个也可以由二个条件式构成。如果二个,之间可以用“与”或“或者”联系。
 * 每个条件式都由一个字段名加一个关系符再加一个问号组成。其格式为[字段名][关系符]?。
 * 例如:“姓名等于?”、“简历包含?”、“学号等于?与分数大于等于?”等。
 * 关系符只能从{"大于"、 "小于"、"等于"、大于等于"、小于等于"、"不等于"、"包含"、"不包含"}中选择一个,
 * 如果输入错误会导致程序显示错误或无法进行查询。
 * 数据表表名可以是一个表,可以是多个表,可以含代码表。必须借本系统菜单生成程序应用鼠标从列表框中选择生成。
 * 选表时,每新加一个表,都必须和前面某个表有一个相同字段名。
 * 例如输入顺序是:数据表1、代码表1、代码表2、数据表2、代码表3等。
 * 其中代码表1、代码表2是数据表1的代码表,代码表3是数据表2的代码表。数据表1和数据表2有同名字段。
 * 问号可以用中文问号也可以用英文问号,每个条件中必须在最后有一个问号。
 * 条件表达式不得超过2个,如果是二个条件之间必须有“与”或“或者”。
 * 查询结果可以与其他部件程序一样根据所选择字段输出,如果填写了输出要求,也可以根据输出要求输出。
 * 输出要求parameter[14]中填写由字段名或简单的加减乘除表达式构成的SQL语句能识别的子句。
 * 注意如果是多表,当字段名为二表共有时,写输出要求必须在字段名前加 表名和点。
 * 例如:学生.学号 as 学号,姓名,班级,专业,分数*20 as 成绩
 * 则输出为有学号、姓名、班级、专业、成绩等列数据的表。
 * 输出要求如果有聚集函数或其他函数,必须遵循相关规则。
 * 例如如果求聚集函数值,除聚集函数外只能有份组字段,不能同时有其他字段。
 * 允许给出分组字段要求,只能按组输出统计数据。
 * 在输出要求中如果涉及常量,输入数据时要求能根据数据类型加英文单引号或不加引号。
 * 如果是数字量或者是字段名,不加引号,如果是字符类数据,必须加单引号。
 * 例如:sum(收入) as 总收入,avg(收入) as 平均收入
 * 如果需要打印,要求先通过桌面系统调用“printFormat1.java”程序,
 * 根据输入的格式文件名生成打印格式文件,在调用本程序时必须给定参数:打印格式文件名。   * 在调用本程序时必须给定参数:打印格式文件名。            
 */

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.table.*;

import java.sql.*;

public class dataQuery9 extends JFrame {
 static dataQuery9 frame = new dataQuery9();
 static String 表名;
 static String 字典表名;
 static String 表名表;
 static DefaultTableModel tableModel;
 static JTable table;
 static JScrollPane scrollPane = new JScrollPane();
 static JTextField aTextField, aTextField2;
 static JButton b1, b2;
 static String s1 = "";
 static ResultSet rs;
 static int b = 0, c = 0;
 static int 列数;
 static int 表格列数;
 static String[][] 列名;
 static String 指定的字段名 = "", 字段名串 = "", 字段名串1 = "";
 static String[][] 关系表 = { { " > ", "大于" }, { " < ", "小于" },
   { " = ", "等于" }, { " >= ", "大于等于" }, { " <= ", "小于等于" },
   { "<>", "不等于" }, { " like ", "包含" }, { " not like ", "不包含" } };
 static String[] 列标题;
 static String[] 列数据类型;
 static String[] 表列数据类型;
 static int[] 列数据宽度;
 static int[] 表列数据宽度;
 static int 记录条数, 记录条数1;
 static String[][] 表格数据;// 存放表格数据的数组

 static int 列序号 = 0, 列序号1 = 0;
 static String 连接条件;
 static String 关系符 = "", 关系符1 = "", 连接符 = "", 关系符0 = "", 关系符01 = "";
 static String 字段名 = "", 字段名1 = "";
 static String 条件表达式;
 static String 字段名字串;
 static String[] 字段号表;
 static int 左边距 = 80;
 static String[] 条件;
 static String 输出要求;
 static String 打印格式文件名;

 static Connection con; // 连接数据库
 static ResultSetMetaData rsmd3;
 static Statement sta3;
 static int 窗口宽 = 1000, 窗口高 = 600;
 static int 按钮数 = 0, 按钮宽 = 0;
 static String[] 按钮集 = null;
 static String 要求按钮号表;
 static JButton printViewButton, printButton;

 public static void means(final String[] parameter) {
  frame = new dataQuery9();
  scrollPane = new JScrollPane();
  s1 = "";
  b = 0;
  c = 0;
  指定的字段名 = "";
  字段名串 = "";
  字段名串1 = "";
  列序号 = 0;
  列序号1 = 0;
  关系符 = "";
  关系符1 = "";
  连接符 = "";
  关系符0 = "";
  关系符01 = "";
  字段名 = "";
  字段名1 = "";
  窗口宽 = 1000;
  窗口高 = 600;
  关系表[0][0] = " > ";
  关系表[0][1] = "大于";
  关系表[1][0] = " < ";
  关系表[1][1] = "小于";
  关系表[2][0] = " = ";
  关系表[2][1] = "等于";
  关系表[3][0] = " >= ";
  关系表[3][1] = "大于等于";
  关系表[4][0] = " <= ";
  关系表[4][1] = "小于等于";
  关系表[5][0] = " <> ";
  关系表[5][1] = "不等于";
  关系表[6][0] = " like ";
  关系表[6][1] = "包含";
  关系表[7][0] = " not like ";
  关系表[7][1] = "不包含";

  String[] 按钮集01 = { "查询", "打印预览", "打印", "退出" };
  按钮集 = new String[按钮集01.length];
  按钮数 = 0;
  for (int i0 = 0; i0 < 按钮集01.length; i0++)
   按钮集[i0] = 按钮集01[i0];
  if (parameter[11].length() > 0) {
   要求按钮号表 = parameter[11];// 需要显示的按钮的顺序号
   // 将中文分号、冒号、句号、英文分号统一为英文分号
   要求按钮号表 = 要求按钮号表.replaceAll(";", ";");
   要求按钮号表 = 要求按钮号表.replaceAll("。", ";");
   要求按钮号表 = 要求按钮号表.replaceAll(":", ";");
   要求按钮号表 = 要求按钮号表.replaceAll(":", ";");
   if (要求按钮号表.indexOf(";") > 0) { // 如果有按钮更名要求
    String s601[] = 要求按钮号表.split(",");
    要求按钮号表 = "";
    for (int i01 = 0; i01 < s601.length; i01++) {
     if (s601[i01].indexOf(";") > 0) {
      String s602[] = s601[i01].split(";");
      按钮集[Integer.parseInt((s602[0]))] = s602[1];
      要求按钮号表 = 要求按钮号表 + "," + s602[0];// 只留号,去更名
      按钮数++;
     } else {
      要求按钮号表 = 要求按钮号表 + "," + s601[i01];// 只留号,原无更名
      按钮数++;
     }
    }
   } // 如果没有按钮更名要求,要求按钮号长度又大于0,保持原有摸样
   else {
    String s601[] = 要求按钮号表.split(",");
    要求按钮号表 = "";
    for (int i01 = 0; i01 < s601.length; i01++) {
     if (i01 == 0)
      要求按钮号表 = s601[i01];
     else
      要求按钮号表 = 要求按钮号表 + "," + s601[i01];
     按钮数++;
    }
   }
  } else {
   要求按钮号表 = ""; // 没输入要求按钮号,定全部按钮号
   for (int i1 = 0; i1 < 按钮集.length; i1++) {
    if (i1 == 0)
     要求按钮号表 = 要求按钮号表 + i1;
    else
     要求按钮号表 = 要求按钮号表 + "," + i1;
    按钮数++;
   }
  }
  要求按钮号表 = "," + 要求按钮号表 + ",";
  窗口宽 = main1.窗口宽;
  窗口高 = main1.窗口高;
  int m1, m2;
  try {
   if (parameter[17].length() == 0) {
    m1 = 0;
    m2 = 0;
   } else {
    m1 = Integer.parseInt(parameter[17]);// 宽度参数
    m2 = Integer.parseInt(parameter[18]);
   }
   if (m1 > 0) {
    if (m2 < 80) {
     m1 = m1 * 10;
     m2 = m2 * 10;
    }
    窗口宽 = m1;
    窗口高 = m2;
   }
  } catch (Exception e2) {
  }

  表名 = parameter[4];
  连接条件 = parameter[20];
  打印格式文件名 = parameter[15];
  字段名字串 = parameter[19];
  if (字段名字串.lastIndexOf(",") == 字段名字串.length() - 1)
   字段名字串 = 字段名字串.substring(0, 字段名字串.length() - 1);
  String[] s6 = 字段名字串.split(",");
  String s2 = "";
  if (parameter[8].length() > 0) {
   字段号表 = parameter[8].split(",");
   列名 = new String[2][字段号表.length];
   for (int i = 0; i < 字段号表.length; i++) {
    列名[0][i] = s6[Integer.parseInt(字段号表[i])];
    列名[1][i] = 列名[0][i];
    if (s2.length() > 0)
     s2 = s2 + "," + 列名[0][i];
    else
     s2 = 列名[0][i];
   }
   字段名字串 = s2;
  } else {
   列名 = new String[2][s6.length];
   for (int i = 0; i < s6.length; i++) {
    列名[0][i] = s6[i];
    列名[1][i] = 列名[0][i];
    if (s2.length() > 0)
     s2 = s2 + "," + 列名[0][i];
    else
     s2 = 列名[0][i];
   }
   字段名字串 = s2;
   s2 = " * ";
  }
  String s11 = 表名;
  if (表名.indexOf(",") > 0) {
   String[] s12 = 表名.split(",");
   s11 = s12[0];
  }

  表名表 = parameter[0];
  字典表名 = "";
  打印格式文件名 = parameter[15];
  条件表达式 = parameter[10];
  输出要求 = parameter[14];
  String[] t1;
  字典表名 = "";
  if (表名表.lastIndexOf(s11 + "字典表") > 0) {
   t1 = 表名表.split(",");
   for (int i = 0; i < t1.length; i++)
    if (t1[i].lastIndexOf(s11 + "字典表") >= 0)
     字典表名 = t1[i];
  }
  if (字典表名.length() > 0) {
   try {
    con = main1.getConn();
    sta3 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
      ResultSet.CONCUR_UPDATABLE);
    s1 = "select * from " + 字典表名;
    rs = sta3.executeQuery(s1);
    ResultSetMetaData rsmd = rs.getMetaData();
    int 列数0 = rsmd.getColumnCount();

    int numberOfColumns = rsmd.getColumnCount(); // 记录数
    String s14 = "";
    String s15 = "";
    int b = 1;
    while (rs.absolute(b)) {
     b++;
     s14 = rs.getString(1).trim(); // 字段名
     s15 = rs.getString(2).trim(); // 标签名
     for (int j = 0; j < 列名[0].length; j++) {
      if (列名[0][j].trim().equalsIgnoreCase(s14.trim())) {
       列名[1][j] = s15;
       break;
      } else if ((列名[0][j].trim() + ",").indexOf("." + s14
        + ",") > 0) {
       列名[1][j] = 列名[1][j].replace(s14, s15);
       break;
      }
     }
    }
    rs.close(); // 关闭查询结果集
    con.close();
    sta3.close();
   } catch (SQLException e) {
    JOptionPane.showMessageDialog(null, "连接数据库出错!");
   }
  }
  String[] g2, g3;
  if (条件表达式.lastIndexOf("与") > 0) {
   条件 = 条件表达式.split("与");
   连接符 = " and ";
  } else if (条件表达式.lastIndexOf("或者") > 0) {
   条件 = 条件表达式.split("或者");
   连接符 = " or ";
  } else {
   条件 = new String[1];
   条件[0] = 条件表达式;
  }

  if (条件[0].lastIndexOf("大于等于") > 0) {
   关系符0 = ">=";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("大于等于"));
  } else if (条件[0].lastIndexOf("小于等于") > 0) {
   关系符0 = "<=";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("小于等于"));
  } else if (条件[0].lastIndexOf("不等于") > 0) {
   关系符0 = "!=";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("不等于"));
  } else if (条件[0].lastIndexOf("大于") > 0) {
   关系符0 = ">";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("大于"));
  } else if (条件[0].lastIndexOf("小于") > 0) {
   关系符0 = "<";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("小于"));
  } else if (条件[0].lastIndexOf("等于") > 0) {
   关系符0 = "=";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("等于"));
  } else if (条件[0].lastIndexOf("不包含") > 0) {
   关系符0 = "不包含";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("不包含"));
  } else if (条件[0].lastIndexOf("包含") > 0) {
   关系符0 = "包含";
   字段名 = 条件[0].substring(0, 条件[0].lastIndexOf("包含"));
  }
  if (连接符.length() > 0) {
   if (条件[1].lastIndexOf("大于等于") > 0) {
    关系符01 = ">=";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("大于等于"));
   } else if (条件[1].lastIndexOf("小于等于") > 0) {
    关系符01 = "<=";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("小于等于"));
   } else if (条件[1].lastIndexOf("不等于") > 0) {
    关系符01 = "!=";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("不等于"));
   } else if (条件[1].lastIndexOf("大于") > 0) {
    关系符01 = ">";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("大于"));
   } else if (条件[1].lastIndexOf("小于") > 0) {
    关系符01 = "<";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("小于"));
   } else if (条件[1].lastIndexOf("等于") > 0) {
    关系符01 = "=";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("等于"));
   } else if (条件[1].lastIndexOf("不包含") > 0) {
    关系符01 = "不包含";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("不包含"));
   } else if (条件[1].lastIndexOf("包含") > 0) {
    关系符01 = "包含";
    字段名1 = 条件[1].substring(0, 条件[1].lastIndexOf("包含"));
   }
  }
  try {
   con = main1.getConn();// 连接数据库
   sta3 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
     ResultSet.CONCUR_UPDATABLE);

   if (连接条件.trim().length() > 0)
    s1 = "select " + 字段名字串 + " from " + 表名 + " where " + 连接条件;
   else
    s1 = "select " + 字段名字串 + " from " + 表名;
   ResultSet rs = sta3.executeQuery(s1);
   rsmd3 = rs.getMetaData();
   列数 = rsmd3.getColumnCount(); // 获取列数
   列数据类型 = new String[列数]; // 定义列字段类型数组
   列数据宽度 = new int[列数]; // 定义列数据宽度
   for (int i = 0; i < 列数; i++) {
    if ((字段名.length() > 0)
      && (列名[0][i].trim().equalsIgnoreCase(字段名.trim())))
     列序号 = i;
    else if ((列名[0][i].trim() + ",")
      .indexOf("." + 字段名.trim() + ",") > 0)
     列序号 = i;
    if ((字段名1.length() > 0)
      && (列名[0][i].trim().equalsIgnoreCase(字段名1.trim())))
     列序号1 = i;
    else if ((列名[0][i].trim() + ",").indexOf("." + 字段名1.trim()
      + ",") > 0)
     列序号1 = i;
    列数据类型[i] = rsmd3.getColumnTypeName(i + 1);
    列数据宽度[i] = rsmd3.getColumnDisplaySize(i + 1);
    if (列数据宽度[i] < 列名[0][i].length())
     列数据宽度[i] = 列名[0][i].length();
    if (列数据宽度[i] > 50)
     列数据宽度[i] = 50;
    b++;
   }

   int rowNumber = 0;
   rs.last();
   rowNumber = rs.getRow();
   表格数据 = new String[rowNumber][列数];
   rs.absolute(1);
   c = 0; // 行号
   b = 0; // 列号
   while (c < rowNumber) {
    rs.absolute(c + 1);
    while (b < 列数) {
     表格数据[c][b] = rs.getString(b + 1);
     b++;
    }
    c++;
    b = 0;
   }
   rs.close(); // 关闭查询结果集
   sta3.close(); // 关闭连接
   con.close();
  } catch (SQLException e) {
   JOptionPane.showMessageDialog(null, "查询数据出错!" + s1);
  }

  if (连接条件.trim().length() > 0)
   连接条件 = 连接条件 + " and ";

  frame.setTitle("查询部件程序                                作者:程学先"); // 窗口标题
  frame.setBounds(10, 10, 窗口宽 - 10, 窗口高 - 10); // 窗口位置大小
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // 设置窗体的默认关闭模式
  frame.getContentPane().setLayout(null); // 关闭窗口布局管理器
  final JPanel panel = new JPanel(false); // 定义面板
  panel.setLayout(null); // 关闭面板布局管理器
  panel.setBounds(20, 20, 窗口宽 - 50, 窗口高 - 20);

  tableModel = new DefaultTableModel(表格数据, 列名[1]); // 创建表格模型
  table = new JTable(tableModel); // 创建指定表格模型的表格
  table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);// 设置表格的选择模式为单选
  table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  scrollPane.getViewport().add(table, null);
  scrollPane.setBounds(30, 60, 窗口宽 - 100, 窗口高 - 200);
  for (int i = 0; i < 列数; i++) {
   TableColumn tc = table.getColumn(列名[1][i]);// 返回表格的列对象
   tc.setPreferredWidth(列数据宽度[i] * 12);
  }
  panel.add(scrollPane);

  JLabel label1 = new JLabel(条件[0]);
  label1.setBounds(左边距, 10, 条件[0].length() * 15, 20);
  panel.add(label1);
  左边距 = 左边距 + 条件[0].length() * 15;

  aTextField = new JTextField("", 10); // 定义文本框,预设值
  aTextField.setBounds(左边距, 10, 100, 20);
  panel.add(aTextField);
  左边距 = 左边距 + 100;

  if (条件.length > 1) {
   JLabel label3 = new JLabel(条件[1]); // 用标签显示指定的字段名
   label3.setBounds(左边距, 10, 条件[1].length() * 15, 20);
   panel.add(label3);
   左边距 = 左边距 + 条件[1].length() * 15;

   aTextField2 = new JTextField("", 10); // 定义文本框,预设值
   aTextField2.setBounds(左边距, 10, 150, 20);
   panel.add(aTextField2);
  }
  按钮宽 = (窗口宽 - 360) / 按钮数;
  int 左边距 = 350;
  final JButton selectButton = new JButton(按钮集[0]); // 定义查询按钮
  selectButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    String[] s8 = null;
    int c = 0;
    String 输出要求0 = "";
    try {
     con = main1.getConn();
     sta3 = con.createStatement(
       ResultSet.TYPE_SCROLL_INSENSITIVE,
       ResultSet.CONCUR_UPDATABLE);
     if (输出要求.trim().length() < 1)
      输出要求 = 字段名字串;
     s1 = "select " + 输出要求 + " from " + 表名;
     if (连接条件.trim().length() > 0)
      s1 = s1 + " where " + 连接条件 + 列名[0][列序号];
     else
      s1 = s1 + " where " + 列名[0][列序号];

     if (((main1.图形数据类型.lastIndexOf("," + 列数据类型[列序号] + ",")) >= 0)
       || ((main1.图形数据类型.lastIndexOf("," + 列数据类型[列序号1]
         + ",")) >= 0)) {
      JOptionPane.showMessageDialog(null,
        "不允许使用图形与二进制数据类型作为查询条件!", "提示",
        JOptionPane.INFORMATION_MESSAGE);
      return;
     }
     if (关系符0.lastIndexOf("包含") < 0) {
      if (main1.数字数据类型.lastIndexOf("," + 列数据类型[列序号] + ",") >= 0)
       s1 = s1 + 关系符0 + aTextField.getText().trim();
      else
       s1 = s1 + 关系符0 + "'" + aTextField.getText().trim()
         + "'";
     } else {
      if (main1.数字数据类型.lastIndexOf("," + 列数据类型[列序号] + ",") >= 0) {
       JOptionPane.showMessageDialog(null,
         "数字类数据类型不能做包含查询!");
       return;
      } else if (关系符0.lastIndexOf("不包含") >= 0)
       s1 = s1 + " not like '%"
         + aTextField.getText().trim() + "%'";
      else
       s1 = s1 + " like '%" + aTextField.getText().trim()
         + "%'";
     }
     if (条件.length > 1) {
      if (关系符01.lastIndexOf("包含") < 0)
       if (main1.数字数据类型.lastIndexOf("," + 列数据类型[列序号1]
         + ",") >= 0)
        s1 = s1 + " and " + 列名[0][列序号1] + 关系符01
          + aTextField2.getText().trim();
       else
        s1 = s1 + " and " + 列名[0][列序号1] + 关系符01 + "'"
          + aTextField2.getText().trim() + "'";
      else if (main1.数字数据类型.lastIndexOf("," + 列数据类型[列序号1]
        + ",") >= 0) {
       JOptionPane.showMessageDialog(null,
         "数字类数据类型不能做包含查询!");
       return;
      } else if (关系符01.lastIndexOf("不包含") >= 0)
       s1 = s1 + " and " + 列名[0][列序号1] + " not like '%"
         + aTextField2.getText().trim() + "%'";
      else
       s1 = s1 + " and " + 列名[0][列序号1] + " like '%"
         + aTextField2.getText().trim() + "%'";
     }
     if (parameter[9].trim().length() > 0) {
      String[] s0 = parameter[9].split(",");
      String s2 = "";
      for (int k = 0; k < s0.length; k++)
       if (k < s0.length - 1)
        s2 = s2 + 列名[0][Integer.parseInt(s0[k])] + ",";
       else
        s2 = s2 + 列名[0][Integer.parseInt(s0[k])];
      s1 = s1 + " group by " + s2;
     }
     ResultSet rs = sta3.executeQuery(s1);
     int rowNumber = 0; // 记录条数
     rs.last();
     rowNumber = rs.getRow();
     rsmd3 = rs.getMetaData();
     int 列数0 = rsmd3.getColumnCount(); // 获取列数
     列数据宽度 = new int[列数0]; // 定义列数据宽度
     String[][] 列名0 = new String[2][列数0];
     for (int i = 0; i < 列数0; i++) {
      列名0[0][i] = rsmd3.getColumnName(i + 1); // 获取列名存到数组中
      列名0[1][i] = rsmd3.getColumnName(i + 1); // 获取列名存到数组中
      列数据宽度[i] = rsmd3.getColumnDisplaySize(i + 1);
      if (列数据宽度[i] < 列名0[1][i].length())
       列数据宽度[i] = 列名0[1][i].length();
      if (列数据宽度[i] > 50)
       列数据宽度[i] = 50;
     }
     String s4 = "";
     for (int i = 0; i < 列数0; i++) {
      s4 = 列名0[1][i];
      for (int j = 0; j < 列数; j++) {
       if (列名[0][j].trim().equalsIgnoreCase(s4.trim())) {
        列名0[1][i] = s4;
        break;
       }
      }
     }
     表格数据 = new String[rowNumber][列数0];
     c = 0; // 行号
     b = 0; // 列号
     while (c < rowNumber) {
      rs.absolute(c + 1);
      while (b < 列数0) {
       表格数据[c][b] = rs.getString(b + 1);
       b++;
      }
      c++;
      b = 0;
     }
     rs.close(); // 关闭查询结果集
     sta3.close(); // 关闭连接
     con.close();
     tableModel = new DefaultTableModel(表格数据, 列名0[1]); // 列名[1]
     table = new JTable(tableModel);
     table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
     scrollPane.setViewportView(table);
    } catch (Exception e1) {
     JOptionPane.showMessageDialog(null, "查询数据出错!" + s1);
    }
    printViewButton.setEnabled(true);
    printButton.setEnabled(true);
   }
  });
  selectButton.setBounds(左边距, 30, 按钮宽, 20);
  if (要求按钮号表.indexOf(",0,") >= 0) {
   左边距 = 左边距 + 按钮宽;
   panel.add(selectButton);
  }

  printViewButton = new JButton(按钮集[1]);
  printViewButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    dataPreview1.printView1(表格数据, 打印格式文件名);
   }
  });
  printViewButton.setBounds(左边距, 30, 按钮宽, 20);
  if (要求按钮号表.indexOf(",1,") >= 0) {
   左边距 = 左边距 + 按钮宽;
   panel.add(printViewButton);
   printViewButton.setEnabled(false);
  }

  printButton = new JButton(按钮集[2]);
  printButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    dataPrint1.print1(表格数据, 打印格式文件名);
   }
  });
  printButton.setBounds(左边距, 30, 按钮宽, 20);
  if (要求按钮号表.indexOf(",2,") >= 0) {
   左边距 = 左边距 + 按钮宽;
   panel.add(printButton);
   printButton.setEnabled(false);
  }

  final JButton exitButton = new JButton(按钮集[3]);
  exitButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    panel.setVisible(false);
    frame.setVisible(false);
    frame.dispose();
   }
  });
  exitButton.setBounds(左边距, 30, 按钮宽, 20);
  if (要求按钮号表.indexOf(",3,") >= 0) {
   左边距 = 左边距 + 按钮宽;
   panel.add(exitButton);
  }

  frame.getContentPane().add(panel, null); // 安装面板
  frame.setVisible(true); // 安装窗口
  frame.getContentPane().add(panel, BorderLayout.SOUTH);
 }

 public static String[] getArray(String str) {
  String[] array;
  String s1 = str;
  int i = 1;
  while (s1.indexOf(",") != -1) {
   s1 = s1.substring(s1.indexOf(",") + 1, s1.length());
   i++;
  }
  array = new String[i];
  int j = 0;
  while (str.indexOf(",") != -1) {
   array[j] = str.substring(0, str.indexOf(","));
   str = str.substring(str.indexOf(",") + 1, str.length());
   array[j + 1] = str;
   j++;
  }
  return array;
 }
}


版本2
15.源码15,生成表格式报表格式文件
/*
 * 程序文件名:printFormat1.java
 * 作者:程学先
 * 本程序用于辅助生成打印数据库中单数据表的表格式报表格式文件。打印内容只限数据表中数据。
 * 程序功能:用于dataPrint1、printPreview1等程序生成格式文件
 */
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.table.*;
import javax.swing.tree.DefaultMutableTreeNode;

import java.io.*;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Vector;

public class printFormat1 extends JFrame {
 private static printFormat1 frame1 = new printFormat1();
 private static printFormat1 frame2 = new printFormat1();
 private static printFormat1 frame3 = new printFormat1();
 private static printFormat1 frame4 = new printFormat1();
 private static printFormat1 frame5 = new printFormat1();
 private static JPanel panel1 = new JPanel();
 private static JPanel panel2 = new JPanel();
 private static JPanel panel3 = new JPanel();
 private static JPanel panel4 = new JPanel();
 private static JPanel panel5 = new JPanel();
 private static DefaultTableModel variabl19651;
 private static DefaultTableModel variabl19652;
 private static DefaultTableModel variabl19653;
 private static DefaultTableModel variabl19654;
 private static DefaultTableModel variabl19655;
 private static JTable variabl26551;
 private static JTable variabl26552;
 private static JTable variabl26553;
 private static JTable variabl26554;
 private static JTable variabl26555;
 private static JScrollPane scrollPane1 = new JScrollPane();
 private static JScrollPane scrollPane2 = new JScrollPane();
 private static JScrollPane scrollPane3 = new JScrollPane();
 private static JScrollPane scrollPane4 = new JScrollPane();
 private static JScrollPane scrollPane5 = new JScrollPane();
 private static List list1 = new List();
 private static List list2 = new List();
 private static List list3 = new List();
 private static List list4 = new List();
 private static List list5 = new List();
 private static JLabel fl0, fl1, fl2, fl3, fl4, fl5, fl6, fl7, fl8, fl9,
   fl10, fl11, fl12;
 private static JTextField fa0, fa1, fa2, fa3, fa4, fa5, fa6, fa7, fa8, fa9,
   fa10, fa11, fa12;

 private static JLabel fla0, fla1, fla2, fla3, fla4, fla5, fla6, fla7, fla8,
   fla9, fla10, fla11, fla12;
 private static JTextField faa0, faa1, faa2, faa3, faa4, faa5, faa6, faa7,
   faa8, faa9, faa10, faa11, faa12;

 private static JLabel flb0, flb1, flb2, flb3, flb4, flb5, flb6, flb7, flb8,
   flb9, flb10, flb11, flb12;
 private static JTextField fab0, fab1, fab2, fab3, fab4, fab5, fab6, fab7,
   fab8, fab9, fab10, fab11, fab12;

 private static JLabel flc0, flc1, flc2, flc3, flc4, flc5, flc6, flc7, flc8,
   flc9, flc10, flc11, flc12;
 private static JTextField fac0, fac1, fac2, fac3, fac4, fac5, fac6, fac7,
   fac8, fac9, fac10, fac11, fac12;

 private static JLabel fld0, fld1, fld2, fld3, fld4, fld5, fld6, fld7, fld8,
   fld9, fld10, fld11, fld12;
 private static JTextField fad0, fad1, fad2, fad3, fad4, fad5, fad6, fad7,
   fad8, fad9, fad10, fad11, fad12;

 private static String variabl2327;
 private static int variabl1823 = -1, variabl1947 = 0, variabl2193 = 0,
   variabl1739 = 0, variabl2651 = 0;
 private static int variabl2127 = 0;
 private static String[][] variabl2197;
 private static ArrayList<String> variabl1665 = new ArrayList();
 private static String[] variabl25171;
 private static String[] variabl1501;
 private static int[] variabl1489;
 private static String[] variabl2157 = new String[12];
 private static int[] variabl21571 = new int[12];
 private static File file1;
 static Connection con;
 static String url;
 static String variabl1275 = "sqlserver";
 static String variabl1091 = "sql1";
 private static Statement sta;
 static String s1 = "", s2 = "";
 private static ResultSet rs;
 private static ResultSetMetaData rsmd;
 private static ArrayList variabl26031 = new ArrayList();
 private static String[] variabl2607 = { "5", "6", "7", "8", "9", "10",
   "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36",
   "48", "72" };
 private static String[] variabl2629 = { "宋体", "楷体", "黑体", "仿宋_GB2312" };

 public static void means(String[] parameter) {
  String variabl2603 = parameter[4];
  frame1 = new printFormat1();
  frame2 = new printFormat1();
  frame3 = new printFormat1();
  frame4 = new printFormat1();
  frame5 = new printFormat1();
  panel1 = new JPanel();
  panel2 = new JPanel();
  panel3 = new JPanel();
  panel4 = new JPanel();
  panel5 = new JPanel();
  scrollPane1 = new JScrollPane();
  scrollPane2 = new JScrollPane();
  scrollPane3 = new JScrollPane();
  scrollPane4 = new JScrollPane();
  scrollPane5 = new JScrollPane();
  list1 = new List();
  list2 = new List();
  list3 = new List();
  list4 = new List();
  list5 = new List();
  variabl1823 = -1;
  variabl1947 = 0;
  variabl2193 = 0;
  variabl1739 = 0;
  variabl2651 = 0;
  variabl2127 = 0;
  variabl1665 = new ArrayList();
  variabl2157 = new String[12];
  variabl21571 = new int[12];
  variabl1275 = "sqlserver";
  variabl1091 = "sql1";
  s1 = "";
  s2 = "";
  variabl26031 = new ArrayList();
  variabl2607 = new String[19];
  variabl2629 = new String[4];
  variabl2607[0] = "5";
  variabl2607[1] = "6";
  variabl2607[2] = "7";
  variabl2607[3] = "8";
  variabl2607[4] = "9";
  variabl2607[5] = "10";
  variabl2607[6] = "11";
  variabl2607[7] = "12";
  variabl2607[8] = "14";
  variabl2607[9] = "16";
  variabl2607[10] = "18";
  variabl2607[11] = "20";
  variabl2607[12] = "22";
  variabl2607[13] = "24";
  variabl2607[14] = "26";
  variabl2607[15] = "28";
  variabl2607[16] = "36";
  variabl2607[17] = "48";
  variabl2607[18] = "72";
  variabl2629[0] = "宋体";
  variabl2629[1] = "楷体";
  variabl2629[2] = "黑体";
  variabl2629[3] = "仿宋_GB2312";
  try {
   con = main1.getConn();
   sta = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
     ResultSet.CONCUR_UPDATABLE);

   s1 = "select " + parameter[19] + " from " + variabl2603;
   if (variabl2603.indexOf(",") > 0)
    s1 = s1 + " where " + parameter[20];
   rs = sta.executeQuery(s1);
   rs.last();
   rsmd = rs.getMetaData();
   variabl2651 = rsmd.getColumnCount();
   variabl25171 = new String[variabl2651];
   variabl1501 = new String[variabl2651];
   variabl1489 = new int[variabl2651];
   variabl1739 = 1;
   list1.removeAll();
   variabl25171 = parameter[19].split(",");
   for (int i = 0; i < variabl2651; i++) {
    variabl1501[i] = rsmd.getColumnTypeName(i + 1);
    variabl1489[i] = rsmd.getColumnDisplaySize(i + 1);
    list1.add(variabl25171[i]);
   }
   rs.close();
   sta.close();
   con.close();
  } catch (SQLException e1) {
   JOptionPane.showMessageDialog(null, "获取数据结构出错!" + s1);
  }

  frame1.setTitle("打印报表标题设计页,每表打印一次。                           作者:程学先");
  frame2.setTitle("表头设计页,每页打印一次。                           作者:程学先");
  frame3.setTitle("报表表体内容设计页,每条记录打印一次。                           作者:程学先");
  frame4.setTitle("打印报表页尾设计页,每页打印一次。                           作者:程学先");
  frame5.setTitle("打印报表表尾设计页,每表打印一次。                           作者:程学先");

  frame1.setBounds(10, 10, 1000, 660);
  frame2.setBounds(100, 10, 1000, 660);
  frame3.setBounds(200, 10, 1000, 660);
  frame4.setBounds(10, 120, 1000, 600);
  frame5.setBounds(200, 120, 1000, 600);
 frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame3.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame4.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame5.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

  panel1.setBounds(10, 10, 1000, 660);
  panel2.setBounds(100, 10, 1000, 660);
  panel3.setBounds(200, 10, 1000, 660);
  panel4.setBounds(10, 120, 1000, 600);
  panel5.setBounds(200, 120, 1000, 600);

  panel1.setLayout(null);
  panel2.setLayout(null);
  panel3.setLayout(null);
  panel4.setLayout(null);
  panel5.setLayout(null);

  String[] variabl251701 = { "内容或变量", "变量名", "行号", "列号", "宽度", "高度",
    "左边距", "到顶距", "字体", "字号" };
  String[] variabl251702 = { "字段标签", "行号", "列号", "宽度", "高度", "左边距", "字体",
    "字号", "有无下表格线", "有无右表格线" };
  String[] variabl251703 = { "字段名称", "字段宽度", "每行高度", "字体", "字号",
    "有无下表格线", "有无右表格线" };
  String[] variabl251704 = { "内容或变量", "变量名", "行号", "列号", "宽度", "高度",
    "左边距", "到顶距", "字体", "字号" };
  String[] variabl251705 = { "内容或变量", "变量名", "行号", "列号", "宽度", "高度",
    "左边距", "到顶距", "字体", "字号" };
  main1.driver1();
  fl0 = new JLabel("数据表名");
  fl0.setBounds(40, 10, 80, 20);
  panel1.add(fl0);
  fa0 = new JTextField("");
  fa0.setText(variabl2603);
  fa0.setBounds(130, 10, 100, 20);
  panel1.add(fa0);
  fa0.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 0;
    list1.removeAll();
    if (variabl26031.size() < 1) {
     try {
      con = main1.getConn();
      String[] tableType = { "TABLE" };
      DatabaseMetaData databaseMetaData = con.getMetaData();
      ResultSet resultSet = databaseMetaData.getTables(null,
        null, "%", tableType);
      while (resultSet.next()) {
       variabl26031.add(resultSet.getString("TABLE_NAME"));
      }
     } catch (Exception e) {
      e.printStackTrace();
     }
    }
    for (int i = 0; i < variabl26031.size(); i++)
     list1.add(variabl26031.get(i).toString());
   }
  });

  fl10 = new JLabel("文件名");
  fl10.setBounds(250, 10, 50, 20);
  panel1.add(fl10);
  fa10 = new JTextField("", 20);
  fa10.setBounds(300, 10, 100, 20);
  panel1.add(fa10);
  fa10.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (fa10.getText().length() < 1) {
     final JFileChooser fc = new JFileChooser(".\\");
     fc.showOpenDialog(null);
     if (fc.getSelectedFile() != null) {
      fa10.setText(fc.getSelectedFile().toString());
      file1 = new File(fa10.getText());
      try {
       if (file1.exists()) {
        FileReader fr = new FileReader(file1);
        BufferedReader br = new BufferedReader(fr);
        String tempStr = null;
        variabl1665.clear();
        for (int i = 0; (tempStr = br.readLine()) != null; i++) {
         if (tempStr.substring(0, 2).equals("1,")) {
          variabl19651.addRow(tempStr.substring(
            2, tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "2,")) {
          variabl19652.addRow(tempStr.substring(
            2, tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "3,")) {
          variabl19653.addRow(tempStr.substring(
            2, tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "4,")) {
          variabl19654.addRow(tempStr.substring(
            2, tempStr.length()).split("。"));
         } else if (tempStr.substring(0, 2).equals(
           "5,")) {
          variabl19655.addRow(tempStr.substring(
            2, tempStr.length()).split("。"));
         }
        }
       }
      } catch (IOException e2) {
       JOptionPane.showMessageDialog(null, "打开文件错!");
      }
     }
    }
   }
  });

  variabl19651 = new DefaultTableModel(variabl2197, variabl251701);
  variabl19652 = new DefaultTableModel(variabl2197, variabl251702);
  variabl19653 = new DefaultTableModel(variabl2197, variabl251703);
  variabl19654 = new DefaultTableModel(variabl2197, variabl251704);
  variabl19655 = new DefaultTableModel(variabl2197, variabl251705);

  variabl26551 = new JTable(variabl19651);
  variabl26552 = new JTable(variabl19652);
  variabl26553 = new JTable(variabl19653);
  variabl26554 = new JTable(variabl19654);
  variabl26555 = new JTable(variabl19655);

  variabl26551.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  variabl26552.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  variabl26553.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  variabl26554.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  variabl26555.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

  variabl26551.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int variabl1823 = variabl26551.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (variabl19651.getValueAt(variabl1823, j) != null)
      variabl2327 = variabl19651.getValueAt(variabl1823, j)
        .toString();
     else
      variabl2327 = "";
     switch (j) {
     case 0:
      fa1.setText(variabl2327.toString());
      break;
     case 1:
      fa2.setText(variabl2327.toString());
      break;
     case 2:
      fa11.setText(variabl2327.toString());
      break;
     case 3:
      fa12.setText(variabl2327.toString());
      break;
     case 4:
      fa3.setText(variabl2327.toString());
      break;
     case 5:
      fa4.setText(variabl2327.toString());
      break;
     case 6:
      fa5.setText(variabl2327.toString());
      break;
     case 7:
      fa6.setText(variabl2327.toString());
      break;
     case 8:
      fa7.setText(variabl2327.toString());
      break;
     case 9:
      fa8.setText(variabl2327.toString());
      break;
     case 10:
      fa9.setText(variabl2327.toString());
      break;
     }
    }
   }
  });
  scrollPane1.setBounds(10, 40, 800, 400);
  scrollPane2.setBounds(10, 40, 800, 400);
  scrollPane3.setBounds(10, 40, 800, 400);
  scrollPane4.setBounds(10, 40, 800, 300);
  scrollPane5.setBounds(10, 40, 800, 300);
  scrollPane1.setViewportView(variabl26551);
  scrollPane2.setViewportView(variabl26552);
  scrollPane3.setViewportView(variabl26553);
  scrollPane4.setViewportView(variabl26554);
  scrollPane5.setViewportView(variabl26555);

  panel1.add(scrollPane1, BorderLayout.CENTER);
  panel2.add(scrollPane2, BorderLayout.CENTER);
  panel3.add(scrollPane3, BorderLayout.CENTER);
  panel4.add(scrollPane4, BorderLayout.CENTER);
  panel5.add(scrollPane5, BorderLayout.CENTER);

  fl1 = new JLabel("内容");
  fl1.setBounds(70, 460, 40, 20);
  panel1.add(fl1);
  fa1 = new JTextField("", 20);
  fa1.setBounds(110, 460, 100, 20);
  panel1.add(fa1);
  fa1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 1;
    list1.removeAll();
   }
  });

  fl2 = new JLabel("变量名");
  fl2.setBounds(230, 460, 50, 20);
  panel1.add(fl2);
  fa2 = new JTextField("", 20);
  fa2.setBounds(280, 460, 60, 20);
  panel1.add(fa2);
  fa2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 2;
    list1.removeAll();
   }
  });

  fl11 = new JLabel("行号");
  fl11.setBounds(370, 460, 40, 20);
  panel1.add(fl11);
  fa11 = new JTextField("", 20);
  fa11.setBounds(410, 460, 60, 20);
  panel1.add(fa11);
  fa11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 11;
    list1.removeAll();
   }
  });

  fl12 = new JLabel("列号");
  fl12.setBounds(500, 460, 40, 20);
  panel1.add(fl12);
  fa12 = new JTextField("", 20);
  fa12.setBounds(540, 460, 60, 20);
  panel1.add(fa12);
  fa12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 12;
    list1.removeAll();
   }
  });

  fl3 = new JLabel("宽度");
  fl3.setBounds(630, 460, 40, 20);
  panel1.add(fl3);
  fa3 = new JTextField("", 20);
  fa3.setBounds(670, 460, 60, 20);
  panel1.add(fa3);
  fa3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 3;
    list1.removeAll();
   }
  });

  fl4 = new JLabel("高度");
  fl4.setBounds(760, 460, 40, 20);
  panel1.add(fl4);
  fa4 = new JTextField("", 20);
  fa4.setBounds(800, 460, 60, 20);
  panel1.add(fa4);
  fa4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 4;
    list1.removeAll();
   }
  });

  fl5 = new JLabel("左边距");
  fl5.setBounds(60, 500, 50, 20);
  panel1.add(fl5);
  fa5 = new JTextField("", 20);
  fa5.setBounds(110, 500, 100, 20);
  panel1.add(fa5);
  fa5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 5;
    list1.removeAll();
   }
  });

  fl6 = new JLabel("到顶距");
  panel1.add(fl6);
  fa6 = new JTextField("", 20);
  panel1.add(fa6);
  fl6.setBounds(220, 500, 60, 20);
  fa6.setBounds(280, 500, 60, 20);
  fa6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 6;
    list1.removeAll();
   }
  });

  fl7 = new JLabel("字体");
  panel1.add(fl7);
  fa7 = new JTextField("", 20);
  panel1.add(fa7);
  fl7.setBounds(370, 500, 40, 20);
  fa7.setBounds(410, 500, 120, 20);
  fa7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 7;
    list1.removeAll();
    for (int i = 0; i < variabl2629.length; i++) {
     list1.add(variabl2629[i]);
    }
   }
  });

  fl8 = new JLabel("字号");
  panel1.add(fl8);
  fa8 = new JTextField("", 20);
  panel1.add(fa8);
  fl8.setBounds(560, 500, 40, 20);
  fa8.setBounds(600, 500, 100, 20);
  fa8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 8;
    list1.removeAll();
    for (int i = 0; i < variabl2607.length; i++) {
     list1.add(variabl2607[i]);
    }
   }
  });

  list1.setBounds(840, 10, 120, 430);
  panel1.add(list1);
  list1.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list1.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (variabl1739) {
     case 0:
      break;
     case 1:
      fa1.setText(list1.getSelectedItem());
      break;
     case 2:
      fa2.setText(list1.getSelectedItem());
      break;
     case 3:
      fa3.setText(list1.getSelectedItem());
      break;
     case 4:
      fa4.setText(list1.getSelectedItem());
      break;
     case 5:
      fa5.setText(list1.getSelectedItem());
      break;
     case 6:
      fa6.setText(list1.getSelectedItem());
      break;
     case 7:
      fa7.setText(list1.getSelectedItem());
      break;
     case 8:
      fa8.setText(list1.getSelectedItem());
      break;
     case 11:
      fa11.setText(list1.getSelectedItem());
      break;
     case 12:
      fa12.setText(list1.getSelectedItem());
      break;
     }
    }
   }
  });

  final JButton addButton = new JButton("添加到表格中");
  addButton.setBounds(50, 540, 120, 20);
  addButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {

    int variabl1823 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < variabl19651.getRowCount(); i++) {
     if ((variabl19651.getValueAt(i, 0) != null)
       && (variabl19651.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fa1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 < 0) {
     String[] rowValues = { fa1.getText(), fa2.getText(),
       fa11.getText(), fa12.getText(), fa3.getText(),
       fa4.getText(), fa5.getText(), fa6.getText(),
       fa7.getText(), fa8.getText() };
     variabl19651.addRow(rowValues);
     int rowCount = variabl26551.getRowCount() + 1;
     fa1.setText("");
     fa2.setText("0");
     fa3.setText("0");
     fa4.setText("0");
     fa5.setText("0");
     fa6.setText("0");
     fa7.setText("");
     fa8.setText("0");
     fa11.setText("0");
     fa12.setText("0");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel1.add(addButton);

  final JButton updButton = new JButton("修改表格数据");
  updButton.setBounds(170, 540, 120, 20);
  updButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1;
    for (int i = 0; i < variabl19651.getRowCount(); i++) {
     if ((variabl19651.getValueAt(i, 0) != null)
       && (variabl19651.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fa1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 >= 0) {
     variabl19651.setValueAt(fa1.getText(), variabl1823, 0);
     variabl19651.setValueAt(fa2.getText(), variabl1823, 1);
     variabl19651.setValueAt(fa11.getText(), variabl1823, 2);
     variabl19651.setValueAt(fa12.getText(), variabl1823, 3);
     variabl19651.setValueAt(fa3.getText(), variabl1823, 4);
     variabl19651.setValueAt(fa4.getText(), variabl1823, 5);
     variabl19651.setValueAt(fa5.getText(), variabl1823, 6);
     variabl19651.setValueAt(fa6.getText(), variabl1823, 7);
     variabl19651.setValueAt(fa7.getText(), variabl1823, 8);
     variabl19651.setValueAt(fa8.getText(), variabl1823, 9);
     variabl19651.setValueAt(fa9.getText(), variabl1823, 10);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel1.add(updButton);

  final JButton delButton = new JButton("从表格中删除");
  delButton.setBounds(290, 540, 120, 20);
  delButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = variabl26551.getSelectedRow();
    if (variabl1823 != -1)
     variabl19651.removeRow(variabl1823);
   }
  });
  panel1.add(delButton);

  final JButton countButton = new JButton("辅助计算");
  countButton.setBounds(410, 540, 120, 20);
  countButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl2059 = variabl19651.getRowCount();
    String[][] variabl2649 = new String[variabl2059][11];
    int[][] variabl26491 = new int[variabl2059][11];
    for (int i = 0; i < variabl2059; i++) {
     for (int j = 0; j < 10; j++)
      variabl2649[i][j] = variabl19651.getValueAt(i, j)
        .toString().trim();
     for (int j = 4; j < 10; j++) {
      if (j != 8) {
       if (variabl2649[i][j].length() > 0)
        variabl26491[i][j] = Integer
          .valueOf(variabl2649[i][j]);
       else
        variabl26491[i][j] = 0;
      }
     }
     for (int j = 4; j < 8; j++) {
      if (j != 5)
       variabl26491[i][j] = variabl26491[i][j]
         * variabl26491[i][9];
      else
       variabl26491[i][j] = (int) (variabl26491[i][j]
         * variabl26491[i][9] * 1.3);
      variabl2649[i][j] = "" + variabl26491[i][j];
     }
    }

    variabl19651.setRowCount(0);
    for (int i = 0; i < variabl2059; i++)
     variabl19651.addRow(variabl2649[i]);
   }
  });
  panel1.add(countButton);

  final JButton creButton = new JButton("表格内容存盘");
  creButton.setBounds(530, 540, 120, 20);
  creButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    char x1 = 10, x2 = 13, x3 = '"', x4 = ',';
    file1 = new File(fa10.getText());
    FileOutputStream fs;
    try {
     fs = new FileOutputStream(file1);
     for (int i = 0; i < variabl19651.getRowCount(); i++) {
      String s3 = "1,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((variabl19651.getValueAt(i, j) != null)
         && (variabl19651.getValueAt(i, j)
           .toString().length() > 0))
        s3 = s3
          + variabl19651.getValueAt(i, j)
            .toString() + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }
     for (int i = 0; i < variabl19652.getRowCount(); i++) {
      String s3 = "2,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((variabl19652.getValueAt(i, j) != null)
         && (variabl19652.getValueAt(i, j)
           .toString().length() > 0))
        s3 = s3
          + variabl19652.getValueAt(i, j)
            .toString() + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }
     for (int i = 0; i < variabl19653.getRowCount(); i++) {
      String s3 = "3,", s4 = "";
      for (int j = 0; j < 7; j++) {
       if ((variabl19653.getValueAt(i, j) != null)
         && (variabl19653.getValueAt(i, j)
           .toString().length() > 0))
        s3 = s3
          + variabl19653.getValueAt(i, j)
            .toString() + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }

     for (int i = 0; i < variabl19654.getRowCount(); i++) {
      String s3 = "4,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((variabl19654.getValueAt(i, j) != null)
         && (variabl19654.getValueAt(i, j)
           .toString().length() > 0))
        s3 = s3
          + variabl19654.getValueAt(i, j)
            .toString() + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }

     for (int i = 0; i < variabl19655.getRowCount(); i++) {
      String s3 = "5,", s4 = "";
      for (int j = 0; j < 10; j++) {
       if ((variabl19655.getValueAt(i, j) != null)
         && (variabl19655.getValueAt(i, j)
           .toString().length() > 0))
        s3 = s3
          + variabl19655.getValueAt(i, j)
            .toString() + "。";
       else
        s3 = s3 + " 。";
      }
      fs.write((s3 + x1).getBytes());
     }

     fs.close();
    } catch (IOException e2) {
     JOptionPane.showMessageDialog(null, "写文件错。");
    }
   }
  });
  panel1.add(creButton);

  final JButton clearButton = new JButton("清参数文本框");
  clearButton.setBounds(650, 540, 120, 20);
  clearButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fa1.setText("");
    fa2.setText("0");
    fa3.setText("0");
    fa4.setText("0");
    fa5.setText("0");
    fa6.setText("0");
    fa7.setText("");
    fa8.setText("0");
    fa9.setText("");
    fa11.setText("0");
    fa12.setText("0");
   }
  });
  panel1.add(clearButton);

  final JButton exitButton = new JButton("退出");
  exitButton.setBounds(770, 540, 120, 20);
  exitButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    panel1.setVisible(false);
    frame1.setVisible(false);
    frame1.dispose();
    frame2.setVisible(false);
    frame2.dispose();
    frame3.setVisible(false);
    frame3.dispose();
    frame4.setVisible(false);
    frame4.dispose();
    frame5.setVisible(false);
    frame5.dispose();
   }
  });
  panel1.add(exitButton);

  fla1 = new JLabel("标签名称");
  fla1.setBounds(50, 460, 60, 20);
  panel2.add(fla1);
  faa1 = new JTextField("", 20);
  faa1.setBounds(110, 460, 100, 20);
  panel2.add(faa1);
  faa1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 1;
    list2.removeAll();
    for (int i = 0; i < variabl2651; i++) {
     list2.add(variabl25171[i]);
    }
   }
  });

  fla11 = new JLabel("行号");
  fla11.setBounds(240, 460, 40, 20);
  panel2.add(fla11);
  faa11 = new JTextField("", 20);
  faa11.setBounds(280, 460, 60, 20);
  panel2.add(faa11);
  faa11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 11;
    list2.removeAll();
   }
  });

  fla12 = new JLabel("列号");
  fla12.setBounds(370, 460, 40, 20);
  panel2.add(fla12);
  faa12 = new JTextField("", 20);
  faa12.setBounds(410, 460, 60, 20);
  panel2.add(faa12);
  faa12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 12;
    list2.removeAll();
   }
  });

  fla2 = new JLabel("宽度");
  fla2.setBounds(500, 460, 40, 20);
  panel2.add(fla2);
  faa2 = new JTextField("", 20);
  faa2.setBounds(540, 460, 60, 20);
  panel2.add(faa2);
  faa2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 2;
    list2.removeAll();
   }
  });

  fla3 = new JLabel("高度");
  fla3.setBounds(630, 460, 40, 20);
  panel2.add(fla3);
  faa3 = new JTextField("", 20);
  faa3.setBounds(670, 460, 60, 20);
  panel2.add(faa3);
  faa3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 3;
    list2.removeAll();
   }
  });

  fla4 = new JLabel("左边距");
  fla4.setBounds(750, 460, 50, 20);
  panel2.add(fla4);
  faa4 = new JTextField("", 20);
  faa4.setBounds(800, 460, 60, 20);
  panel2.add(faa4);
  faa4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 4;
    list2.removeAll();
   }
  });

  fla5 = new JLabel("字体");
  fla5.setBounds(70, 500, 40, 20);
  panel2.add(fla5);
  faa5 = new JTextField("", 20);
  faa5.setBounds(110, 500, 100, 20);
  panel2.add(faa5);
  faa5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 5;
    list2.removeAll();
    for (int i = 0; i < variabl2629.length; i++) {
     list2.add(variabl2629[i]);
    }
   }
  });

  fla6 = new JLabel("字号");
  panel2.add(fla6);
  faa6 = new JTextField("", 20);
  panel2.add(faa6);
  fla6.setBounds(240, 500, 40, 20);
  faa6.setBounds(280, 500, 60, 20);
  faa6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 6;
    list2.removeAll();
    for (int i = 0; i < variabl2607.length; i++) {
     list2.add(variabl2607[i]);
    }
   }
  });

  fla7 = new JLabel("有无下表格线");
  panel2.add(fla7);
  faa7 = new JTextField("", 20);
  panel2.add(faa7);
  fla7.setBounds(350, 500, 80, 20);
  faa7.setBounds(430, 500, 120, 20);
  faa7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 7;
    list2.removeAll();
    list2.add("有");
    list2.add("无");
   }
  });

  fla8 = new JLabel("有无右表格线");
  panel2.add(fla8);
  faa8 = new JTextField("", 20);
  panel2.add(faa8);
  fla8.setBounds(560, 500, 80, 20);
  faa8.setBounds(640, 500, 100, 20);
  faa8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 8;
    list2.removeAll();
    list2.add("有");
    list2.add("无");
   }
  });

  faa1.setText("");
  faa2.setText("0");
  faa3.setText("0");
  faa4.setText("0");
  faa5.setText("0");
  faa6.setText("0");
  faa7.setText("");
  faa8.setText("0");
  faa11.setText("1");
  faa12.setText("1");

  list2.setBounds(840, 10, 120, 430);
  panel2.add(list2);
  list2.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list2.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (variabl1739) {
     case 1:
      faa1.setText(list2.getSelectedItem());
      variabl2127 = list2.getSelectedIndex();
      if ((",ntext,text,memo,image,long,lob,blob,clob,ole,varbinary,varchar,nvarchar,xml"
        .lastIndexOf("," + variabl1501[variabl2127])) < 0) {
       if (variabl1489[variabl2127] > variabl25171[variabl2127]
         .length())
        faa2.setText("" + variabl1489[variabl2127]);
       else
        faa2.setText(""
          + variabl25171[variabl2127].length());
       faa3.setText("1");
      }
      faa5.setText("宋体");
      faa6.setText("12");
      faa7.setText("有");
      faa8.setText("有");
      break;
     case 2:
      faa2.setText(list2.getSelectedItem());
      break;
     case 3:
      faa3.setText(list2.getSelectedItem());
      break;
     case 4:
      faa4.setText(list2.getSelectedItem());
      break;
     case 5:
      faa5.setText(list2.getSelectedItem());
      break;
     case 6:
      faa6.setText(list2.getSelectedItem());
      break;
     case 7:
      faa7.setText(list2.getSelectedItem());
      break;
     case 8:
      faa8.setText(list2.getSelectedItem());
      break;
     case 11:
      faa11.setText(list2.getSelectedItem());
      break;
     case 12:
      faa12.setText(list2.getSelectedItem());
      break;
     }
    }
   }
  });

  variabl26552.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int variabl1823 = variabl26552.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (variabl19652.getValueAt(variabl1823, j) != null)
      variabl2327 = variabl19652.getValueAt(variabl1823, j)
        .toString();
     else
      variabl2327 = "";
     switch (j) {
     case 0:
      faa1.setText(variabl2327.toString());
      break;
     case 1:
      faa11.setText(variabl2327.toString());
      break;
     case 2:
      faa12.setText(variabl2327.toString());
      break;
     case 3:
      faa2.setText(variabl2327.toString());
      break;
     case 4:
      faa3.setText(variabl2327.toString());
      break;
     case 5:
      faa4.setText(variabl2327.toString());
      break;
     case 6:
      faa5.setText(variabl2327.toString());
      break;
     case 7:
      faa6.setText(variabl2327.toString());
      break;
     case 8:
      faa7.setText(variabl2327.toString());
      break;
     case 9:
      faa8.setText(variabl2327.toString());
      break;
     }
    }
   }
  });

  final JButton addButton1 = new JButton("添加到表格中");
  addButton1.setBounds(50, 540, 170, 20);
  addButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < variabl19652.getRowCount(); i++) {
     if ((variabl19652.getValueAt(i, 0) != null)
       && (variabl19652.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(faa1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 < 0) {
     String[] rowValues = { faa1.getText(), faa11.getText(),
       faa12.getText(), faa2.getText(), faa3.getText(),
       faa4.getText(), faa5.getText(), faa6.getText(),
       faa7.getText(), faa8.getText() };
     variabl19652.addRow(rowValues);
     int rowCount = variabl26552.getRowCount() + 1;
     faa1.setText("");
     faa2.setText("0");
     faa3.setText("0");
     faa4.setText("0");
     faa5.setText("0");
     faa6.setText("0");
     faa7.setText("");
     faa8.setText("0");
     faa11.setText("1");
     faa12.setText("1");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel2.add(addButton1);

  final JButton updButton1 = new JButton("修改表格数据");
  updButton1.setBounds(220, 540, 170, 20);
  updButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1;
    for (int i = 0; i < variabl19652.getRowCount(); i++) {
     if ((variabl19652.getValueAt(i, 0) != null)
       && (variabl19652.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(faa1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 >= 0) {
     variabl19652.setValueAt(faa1.getText(), variabl1823, 0);
     variabl19652.setValueAt(faa11.getText(), variabl1823, 1);
     variabl19652.setValueAt(faa12.getText(), variabl1823, 2);
     variabl19652.setValueAt(faa2.getText(), variabl1823, 3);
     variabl19652.setValueAt(faa3.getText(), variabl1823, 4);
     variabl19652.setValueAt(faa4.getText(), variabl1823, 5);
     variabl19652.setValueAt(faa5.getText(), variabl1823, 6);
     variabl19652.setValueAt(faa6.getText(), variabl1823, 7);
     variabl19652.setValueAt(faa7.getText(), variabl1823, 8);
     variabl19652.setValueAt(faa8.getText(), variabl1823, 9);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel2.add(updButton1);

  final JButton delButton1 = new JButton("从表格中删除");
  delButton1.setBounds(390, 540, 170, 20);
  delButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = variabl26552.getSelectedRow();
    if (variabl1823 != -1)
     variabl19652.removeRow(variabl1823);
   }
  });
  panel2.add(delButton1);

  final JButton countButton1 = new JButton("辅助计算");
  countButton1.setBounds(560, 540, 170, 20);
  countButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl2059 = variabl19652.getRowCount();
    String[][] variabl2649 = new String[variabl2059][11];
    int[][] variabl26491 = new int[variabl2059][11];
    for (int i = 0; i < variabl2059; i++) {
     for (int j = 0; j < 10; j++)
      variabl2649[i][j] = variabl19652.getValueAt(i, j)
        .toString().trim();
     for (int j = 3; j < 8; j++) {
      if (j != 6) {
       if (variabl2649[i][j].length() > 0)
        variabl26491[i][j] = Integer
          .valueOf(variabl2649[i][j]);
       else
        variabl26491[i][j] = 0;
      }
     }
     for (int j = 3; j < 6; j++) {
      if (j == 4)
       variabl26491[i][j] = (int) (variabl26491[i][j]
         * variabl26491[i][7] * 1.3);
      else
       variabl26491[i][j] = variabl26491[i][j]
         * variabl26491[i][7];
      variabl2649[i][j] = "" + variabl26491[i][j];
     }
    }
    variabl19652.setRowCount(0);
    for (int i = 0; i < variabl2059; i++)
     variabl19652.addRow(variabl2649[i]);
   }
  });
  panel2.add(countButton1);

  final JButton clearButton1 = new JButton("清参数文本框");
  clearButton1.setBounds(730, 540, 170, 20);
  clearButton1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    faa1.setText("");
    faa2.setText("0");
    faa3.setText("0");
    faa4.setText("0");
    faa5.setText("0");
    faa6.setText("0");
    faa7.setText("");
    faa8.setText("0");
    faa11.setText("1");
    faa12.setText("1");
   }
  });
  panel2.add(clearButton1);

  flb1 = new JLabel("字段名称");
  flb1.setBounds(10, 460, 60, 20);
  panel3.add(flb1);
  fab1 = new JTextField("", 20);
  fab1.setBounds(70, 460, 100, 20);
  panel3.add(fab1);
  fab1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 1;
    list3.removeAll();
    for (int i = 0; i < variabl2651; i++) {
     list3.add(variabl25171[i]);
    }
   }
  });

  flb2 = new JLabel("宽度");
  flb2.setBounds(170, 460, 40, 20);
  panel3.add(flb2);
  fab2 = new JTextField("", 20);
  fab2.setBounds(210, 460, 60, 20);
  panel3.add(fab2);
  fab2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 2;
    list3.removeAll();
   }
  });

  flb3 = new JLabel("每行高度");
  flb3.setBounds(270, 460, 60, 20);
  panel3.add(flb3);
  fab3 = new JTextField("", 20);
  fab3.setBounds(330, 460, 60, 20);
  panel3.add(fab3);
  fab3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 3;
    list3.removeAll();
   }
  });

  flb4 = new JLabel("字体");
  flb4.setBounds(390, 460, 40, 20);
  panel3.add(flb4);
  fab4 = new JTextField("", 20);
  fab4.setBounds(430, 460, 100, 20);
  panel3.add(fab4);
  fab4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 4;
    list3.removeAll();
    for (int i = 0; i < variabl2629.length; i++) {
     list3.add(variabl2629[i]);
    }
   }
  });

  flb5 = new JLabel("字号");
  panel3.add(flb5);
  fab5 = new JTextField("", 20);
  panel3.add(fab5);
  flb5.setBounds(530, 460, 40, 20);
  fab5.setBounds(570, 460, 60, 20);
  fab5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 5;
    list3.removeAll();
    for (int i = 0; i < variabl2607.length; i++) {
     list3.add(variabl2607[i]);
    }
   }
  });

  flb6 = new JLabel("有无下表格线");
  panel3.add(flb6);
  fab6 = new JTextField("", 20);
  panel3.add(fab6);
  flb6.setBounds(630, 460, 80, 20);
  fab6.setBounds(710, 460, 60, 20);
  fab6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 6;
    list3.removeAll();
    list3.add("有");
    list3.add("无");
   }
  });

  flb7 = new JLabel("有无右表格线");
  panel3.add(flb7);
  fab7 = new JTextField("", 20);
  panel3.add(fab7);
  flb7.setBounds(770, 460, 80, 20);
  fab7.setBounds(850, 460, 60, 20);
  fab7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 7;
    list3.removeAll();
    list3.add("有");
    list3.add("无");
   }
  });

  list3.setBounds(840, 10, 120, 430);
  panel3.add(list3);
  list3.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list3.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (variabl1739) {
     case 1:
      fab1.setText(list3.getSelectedItem());
      variabl2127 = list3.getSelectedIndex();
      if ((",ntext,text,memo,image,long,lob,blob,clob,ole,varbinary,varchar,nvarchar,xml"
        .lastIndexOf("," + variabl1501[variabl2127])) < 0) {
       if (variabl1489[variabl2127] > variabl25171[variabl2127]
         .length())
        fab2.setText("" + variabl1489[variabl2127]);
       else
        fab2.setText(""
          + variabl25171[variabl2127].length());
      }
      fab3.setText("1");
      fab4.setText("宋体");
      fab5.setText("12");
      fab6.setText("有");
      fab7.setText("有");
      break;
     case 2:
      fab2.setText(list3.getSelectedItem());
      break;
     case 3:
      fab3.setText(list3.getSelectedItem());
      break;
     case 4:
      fab4.setText(list3.getSelectedItem());
      break;
     case 5:
      fab5.setText(list3.getSelectedItem());
      break;
     case 6:
      fab6.setText(list3.getSelectedItem());
      break;
     case 7:
      fab7.setText(list3.getSelectedItem());
      break;
     }
    }
   }
  });

  variabl26553.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int variabl1823 = variabl26553.getSelectedRow();
    for (int j = 0; j < 7; j++) {
     if (variabl19653.getValueAt(variabl1823, j) != null)
      variabl2327 = variabl19653.getValueAt(variabl1823, j)
        .toString();
     else
      variabl2327 = "";
     switch (j) {
     case 0:
      fab1.setText(variabl2327.toString());
      break;
     case 1:
      fab2.setText(variabl2327.toString());
      break;
     case 2:
      fab3.setText(variabl2327.toString());
      break;
     case 3:
      fab4.setText(variabl2327.toString());
      break;
     case 4:
      fab5.setText(variabl2327.toString());
      break;
     case 5:
      fab6.setText(variabl2327.toString());
      break;
     case 6:
      fab7.setText(variabl2327.toString());
      break;
     }
    }
   }
  });

  final JButton addButton2 = new JButton("添加到表格中");
  addButton2.setBounds(50, 540, 170, 20);
  addButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < variabl19653.getRowCount(); i++) {
     if ((variabl19653.getValueAt(i, 0) != null)
       && (variabl19653.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fab1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 < 0) {
     String[] rowValues = { fab1.getText(), fab2.getText(),
       fab3.getText(), fab4.getText(), fab5.getText(),
       fab6.getText(), fab7.getText() };
     variabl19653.addRow(rowValues);
     int rowCount = variabl26553.getRowCount() + 1;
     fab1.setText("");
     fab2.setText("0");
     fab3.setText("1");
     fab4.setText("宋体");
     fab5.setText("0");
     fab6.setText("有");
     fab7.setText("有");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel3.add(addButton2);

  final JButton updButton2 = new JButton("修改表格数据");
  updButton2.setBounds(220, 540, 170, 20);
  updButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1;
    for (int i = 0; i < variabl19653.getRowCount(); i++) {
     if ((variabl19653.getValueAt(i, 0) != null)
       && (variabl19653.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fab1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 >= 0) {
     variabl19653.setValueAt(fab1.getText(), variabl1823, 0);
     variabl19653.setValueAt(fab2.getText(), variabl1823, 1);
     variabl19653.setValueAt(fab3.getText(), variabl1823, 2);
     variabl19653.setValueAt(fab4.getText(), variabl1823, 3);
     variabl19653.setValueAt(fab5.getText(), variabl1823, 4);
     variabl19653.setValueAt(fab6.getText(), variabl1823, 5);
     variabl19653.setValueAt(fab7.getText(), variabl1823, 6);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel3.add(updButton2);

  final JButton delButton2 = new JButton("从表格中删除");
  delButton2.setBounds(390, 540, 170, 20);
  delButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = variabl26553.getSelectedRow();
    if (variabl1823 != -1)
     variabl19653.removeRow(variabl1823);
   }
  });
  panel3.add(delButton2);

  final JButton countButton2 = new JButton("辅助计算");
  countButton2.setBounds(560, 540, 170, 20);
  countButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl2059 = variabl19653.getRowCount();
    String[][] variabl2649 = new String[variabl2059][11];
    int[][] variabl26491 = new int[variabl2059][11];
    for (int i = 0; i < variabl2059; i++) {
     for (int j = 0; j < 7; j++) {
      variabl2649[i][j] = variabl19653.getValueAt(i, j)
        .toString().trim();
     }
     for (int j = 1; j < 5; j++) {
      if (j != 3) {
       if (variabl2649[i][j].length() > 0)
        variabl26491[i][j] = Integer
          .valueOf(variabl2649[i][j]);
       else
        variabl26491[i][j] = 0;
      }
     }
     variabl26491[i][1] = variabl26491[i][1]
       * variabl26491[i][4];
     variabl2649[i][1] = "" + variabl26491[i][1];
     variabl26491[i][2] = variabl26491[i][2]
       * variabl26491[i][4];
     variabl2649[i][2] = "" + variabl26491[i][2];
    }

    variabl19653.setRowCount(0);
    for (int i = 0; i < variabl2059; i++)
     variabl19653.addRow(variabl2649[i]);
   }
  });
  panel3.add(countButton2);

  final JButton clearButton2 = new JButton("清参数文本框");
  clearButton2.setBounds(730, 540, 170, 20);
  clearButton2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fab1.setText("");
    fab2.setText("0");
    fab3.setText("1");
    fab4.setText("宋体");
    fab5.setText("0");
    fab6.setText("有");
    fab7.setText("有");
   }
  });
  panel3.add(clearButton2);

  flc1 = new JLabel("内容");
  flc1.setBounds(70, 360, 40, 20);
  panel4.add(flc1);
  fac1 = new JTextField("", 20);
  fac1.setBounds(110, 360, 100, 20);
  panel4.add(fac1);
  fac1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 1;
    list4.removeAll();
   }
  });

  flc2 = new JLabel("变量名");
  flc2.setBounds(230, 360, 50, 20);
  panel4.add(flc2);
  fac2 = new JTextField("", 20);
  fac2.setBounds(280, 360, 60, 20);
  panel4.add(fac2);
  fac2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 2;
    list4.removeAll();
   }
  });

  flc11 = new JLabel("行号");
  flc11.setBounds(370, 360, 40, 20);
  panel4.add(flc11);
  fac11 = new JTextField("", 20);
  fac11.setBounds(410, 360, 60, 20);
  panel4.add(fac11);
  fac11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 11;
    list4.removeAll();
   }
  });

  flc12 = new JLabel("列号");
  flc12.setBounds(500, 360, 40, 20);
  panel4.add(flc12);
  fac12 = new JTextField("", 20);
  fac12.setBounds(540, 360, 60, 20);
  panel4.add(fac12);
  fac12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 12;
    list4.removeAll();
   }
  });

  flc3 = new JLabel("宽度");
  flc3.setBounds(630, 360, 40, 20);
  panel4.add(flc3);
  fac3 = new JTextField("", 20);
  fac3.setBounds(670, 360, 60, 20);
  panel4.add(fac3);
  fac3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 3;
    list4.removeAll();
   }
  });

  flc4 = new JLabel("高度");
  flc4.setBounds(760, 360, 40, 20);
  panel4.add(flc4);
  fac4 = new JTextField("", 20);
  fac4.setBounds(800, 360, 60, 20);
  panel4.add(fac4);
  fac4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 4;
    list4.removeAll();
   }
  });

  flc5 = new JLabel("左边距");
  flc5.setBounds(60, 400, 50, 20);
  panel4.add(flc5);
  fac5 = new JTextField("", 20);
  fac5.setBounds(110, 400, 100, 20);
  panel4.add(fac5);
  fac5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 5;
    list4.removeAll();
   }
  });

  flc6 = new JLabel("到顶距");
  panel4.add(flc6);
  fac6 = new JTextField("", 20);
  panel4.add(fac6);
  flc6.setBounds(220, 400, 60, 20);
  fac6.setBounds(280, 400, 60, 20);
  fac6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 6;
    list4.removeAll();
   }
  });

  flc7 = new JLabel("字体");
  panel4.add(flc7);
  fac7 = new JTextField("", 20);
  panel4.add(fac7);
  flc7.setBounds(370, 400, 40, 20);
  fac7.setBounds(410, 400, 120, 20);
  fac7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 7;
    list4.removeAll();
    for (int i = 0; i < variabl2629.length; i++) {
     list4.add(variabl2629[i]);
    }
   }
  });

  flc8 = new JLabel("字号");
  panel4.add(flc8);
  fac8 = new JTextField("", 20);
  panel4.add(fac8);
  flc8.setBounds(560, 400, 40, 20);
  fac8.setBounds(600, 400, 100, 20);
  fac8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 8;
    list4.removeAll();
    for (int i = 0; i < variabl2607.length; i++) {
     list4.add(variabl2607[i]);
    }
   }
  });

  list4.setBounds(840, 10, 120, 330);
  panel4.add(list4);
  list4.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list4.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (variabl1739) {
     case 1:
      fac1.setText(list4.getSelectedItem());
      break;
     case 2:
      fac2.setText(list4.getSelectedItem());
      break;
     case 3:
      fac3.setText(list4.getSelectedItem());
      break;
     case 4:
      fac4.setText(list4.getSelectedItem());
      break;
     case 5:
      fac5.setText(list4.getSelectedItem());
      break;
     case 6:
      fac6.setText(list4.getSelectedItem());
      break;
     case 7:
      fac7.setText(list4.getSelectedItem());
      break;
     case 8:
      fac8.setText(list4.getSelectedItem());
      break;
     case 11:
      fac11.setText(list4.getSelectedItem());
      break;
     case 12:
      fac12.setText(list4.getSelectedItem());
      break;
     }
    }
   }
  });

  variabl26554.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int variabl1823 = variabl26554.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (variabl19654.getValueAt(variabl1823, j) != null)
      variabl2327 = variabl19654.getValueAt(variabl1823, j)
        .toString();
     else
      variabl2327 = "";
     switch (j) {
     case 0:
      fac1.setText(variabl2327.toString());
      break;
     case 1:
      fac2.setText(variabl2327.toString());
      break;
     case 2:
      fac11.setText(variabl2327.toString());
      break;
     case 3:
      fac12.setText(variabl2327.toString());
      break;
     case 4:
      fac3.setText(variabl2327.toString());
      break;
     case 5:
      fac4.setText(variabl2327.toString());
      break;
     case 6:
      fac5.setText(variabl2327.toString());
      break;
     case 7:
      fac6.setText(variabl2327.toString());
      break;
     case 8:
      fac7.setText(variabl2327.toString());
      break;
     case 9:
      fac8.setText(variabl2327.toString());
      break;
     case 10:
      fac9.setText(variabl2327.toString());
      break;
     }
    }
   }
  });

  final JButton addButton4 = new JButton("添加到表格中");
  addButton4.setBounds(50, 440, 170, 20);
  addButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {

    int variabl1823 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < variabl19654.getRowCount(); i++) {
     if ((variabl19654.getValueAt(i, 0) != null)
       && (variabl19654.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fac1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 < 0) {
     String[] rowValues = { fac1.getText(), fac2.getText(),
       fac11.getText(), fac12.getText(), fac3.getText(),
       fac4.getText(), fac5.getText(), fac6.getText(),
       fac7.getText(), fac8.getText() };
     variabl19654.addRow(rowValues);
     int rowCount = variabl26554.getRowCount() + 1;
     fac1.setText("");
     fac2.setText("0");
     fac3.setText("0");
     fac4.setText("0");
     fac5.setText("0");
     fac6.setText("0");
     fac7.setText("");
     fac8.setText("0");
     fac11.setText("0");
     fac12.setText("0");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel4.add(addButton4);

  final JButton updButton4 = new JButton("修改表格数据");
  updButton4.setBounds(220, 440, 170, 20);
  updButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1;
    for (int i = 0; i < variabl19654.getRowCount(); i++) {
     if ((variabl19654.getValueAt(i, 0) != null)
       && (variabl19654.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fac1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 >= 0) {
     variabl19654.setValueAt(fac1.getText(), variabl1823, 0);
     variabl19654.setValueAt(fac2.getText(), variabl1823, 1);
     variabl19654.setValueAt(fac11.getText(), variabl1823, 2);
     variabl19654.setValueAt(fac12.getText(), variabl1823, 3);
     variabl19654.setValueAt(fac3.getText(), variabl1823, 4);
     variabl19654.setValueAt(fac4.getText(), variabl1823, 5);
     variabl19654.setValueAt(fac5.getText(), variabl1823, 6);
     variabl19654.setValueAt(fac6.getText(), variabl1823, 7);
     variabl19654.setValueAt(fac7.getText(), variabl1823, 8);
     variabl19654.setValueAt(fac8.getText(), variabl1823, 9);
     variabl19654.setValueAt(fac9.getText(), variabl1823, 10);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel4.add(updButton4);

  final JButton delButton4 = new JButton("从表格中删除");
  delButton4.setBounds(390, 440, 170, 20);
  delButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = variabl26554.getSelectedRow();
    if (variabl1823 != -1)
     variabl19654.removeRow(variabl1823);
   }
  });
  panel4.add(delButton4);

  final JButton countButton4 = new JButton("辅助计算");
  countButton4.setBounds(560, 440, 170, 20);
  countButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl2059 = variabl19654.getRowCount();
    String[][] variabl2649 = new String[variabl2059][11];
    int[][] variabl26491 = new int[variabl2059][11];
    for (int i = 0; i < variabl2059; i++) {
     for (int j = 0; j < 10; j++)
      variabl2649[i][j] = variabl19654.getValueAt(i, j)
        .toString().trim();
     for (int j = 4; j < 10; j++) {
      if (j != 8) {
       if (variabl2649[i][j].length() > 0)
        variabl26491[i][j] = Integer
          .valueOf(variabl2649[i][j]);
       else
        variabl26491[i][j] = 0;
      }
     }
     for (int j = 4; j < 8; j++) {
      if (j != 5)
       variabl26491[i][j] = variabl26491[i][j]
         * variabl26491[i][9];
      else
       variabl26491[i][j] = (int) (variabl26491[i][j]
         * variabl26491[i][9] * 1.3);
      variabl2649[i][j] = "" + variabl26491[i][j];
     }
    }

    variabl19654.setRowCount(0);
    for (int i = 0; i < variabl2059; i++)
     variabl19654.addRow(variabl2649[i]);
   }
  });
  panel4.add(countButton4);

  final JButton clearButton4 = new JButton("清参数文本框");
  clearButton4.setBounds(730, 440, 170, 20);
  clearButton4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fac1.setText("");
    fac2.setText("0");
    fac3.setText("0");
    fac4.setText("0");
    fac5.setText("0");
    fac6.setText("0");
    fac7.setText("");
    fac8.setText("0");
    fac9.setText("");
    fac11.setText("0");
    fac12.setText("0");
   }
  });
  panel4.add(clearButton4);

  /* 表尾页 */
  fld1 = new JLabel("内容");
  fld1.setBounds(70, 360, 40, 20);
  panel5.add(fld1);
  fad1 = new JTextField("", 20);
  fad1.setBounds(110, 360, 100, 20);
  panel5.add(fad1);
  fad1.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 1;
    list5.removeAll();
   }
  });

  fld2 = new JLabel("变量名");
  fld2.setBounds(230, 360, 50, 20);
  panel5.add(fld2);
  fad2 = new JTextField("", 20);
  fad2.setBounds(280, 360, 60, 20);
  panel5.add(fad2);
  fad2.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 2;
    list5.removeAll();
   }
  });

  fld11 = new JLabel("行号");
  fld11.setBounds(370, 360, 40, 20);
  panel5.add(fld11);
  fad11 = new JTextField("", 20);
  fad11.setBounds(410, 360, 60, 20);
  panel5.add(fad11);
  fad11.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 11;
    list5.removeAll();
   }
  });

  fld12 = new JLabel("列号");
  fld12.setBounds(500, 360, 40, 20);
  panel5.add(fld12);
  fad12 = new JTextField("", 20);
  fad12.setBounds(540, 360, 60, 20);
  panel5.add(fad12);
  fad12.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 12;
    list5.removeAll();
   }
  });

  fld3 = new JLabel("宽度");
  fld3.setBounds(630, 360, 40, 20);
  panel5.add(fld3);
  fad3 = new JTextField("", 20);
  fad3.setBounds(670, 360, 60, 20);
  panel5.add(fad3);
  fad3.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 3;
    list5.removeAll();
   }
  });

  fld4 = new JLabel("高度");
  fld4.setBounds(760, 360, 40, 20);
  panel5.add(fld4);
  fad4 = new JTextField("", 20);
  fad4.setBounds(800, 360, 60, 20);
  panel5.add(fad4);
  fad4.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 4;
    list5.removeAll();
   }
  });

  fld5 = new JLabel("左边距");
  fld5.setBounds(60, 400, 50, 20);
  panel5.add(fld5);
  fad5 = new JTextField("", 20);
  fad5.setBounds(110, 400, 100, 20);
  panel5.add(fad5);
  fad5.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 5;
    list5.removeAll();
   }
  });

  fld6 = new JLabel("到顶距");
  panel5.add(fld6);
  fad6 = new JTextField("", 20);
  panel5.add(fad6);
  fld6.setBounds(220, 400, 60, 20);
  fad6.setBounds(280, 400, 60, 20);
  fad6.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 6;
    list5.removeAll();
   }
  });

  fld7 = new JLabel("字体");
  panel5.add(fld7);
  fad7 = new JTextField("", 20);
  panel5.add(fad7);
  fld7.setBounds(370, 400, 40, 20);
  fad7.setBounds(410, 400, 120, 20);
  fad7.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 7;
    list5.removeAll();
    for (int i = 0; i < variabl2629.length; i++) {
     list5.add(variabl2629[i]);
    }
   }
  });

  fld8 = new JLabel("字号");
  panel5.add(fld8);
  fad8 = new JTextField("", 20);
  panel5.add(fad8);
  fld8.setBounds(560, 400, 40, 20);
  fad8.setBounds(600, 400, 100, 20);
  fad8.addFocusListener(new FocusAdapter() {
   public void focusGained(final FocusEvent arg0) {
    variabl1739 = 8;
    list5.removeAll();
    for (int i = 0; i < variabl2607.length; i++) {
     list5.add(variabl2607[i]);
    }
   }
  });

  list5.setBounds(840, 10, 170, 330);
  panel5.add(list5);
  list5.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    if (list5.getSelectedIndex() >= 0) {
     int w1, w2, h1, h2;
     switch (variabl1739) {
     case 1:
      fad1.setText(list5.getSelectedItem());
      break;
     case 2:
      fad2.setText(list5.getSelectedItem());
      break;
     case 3:
      fad3.setText(list5.getSelectedItem());
      break;
     case 4:
      fad4.setText(list5.getSelectedItem());
      break;
     case 5:
      fad5.setText(list5.getSelectedItem());
      break;
     case 6:
      fad6.setText(list5.getSelectedItem());
      break;
     case 7:
      fad7.setText(list5.getSelectedItem());
      break;
     case 8:
      fad8.setText(list5.getSelectedItem());
      break;
     case 11:
      fad11.setText(list5.getSelectedItem());
      break;
     case 12:
      fad12.setText(list5.getSelectedItem());
      break;
     }
    }
   }
  });

  variabl26555.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
    int variabl1823 = variabl26555.getSelectedRow();
    for (int j = 0; j < 10; j++) {
     if (variabl19655.getValueAt(variabl1823, j) != null)
      variabl2327 = variabl19655.getValueAt(variabl1823, j)
        .toString();
     else
      variabl2327 = "";
     switch (j) {
     case 0:
      fad1.setText(variabl2327.toString());
      break;
     case 1:
      fad2.setText(variabl2327.toString());
      break;
     case 2:
      fad11.setText(variabl2327.toString());
      break;
     case 3:
      fad12.setText(variabl2327.toString());
      break;
     case 4:
      fad3.setText(variabl2327.toString());
      break;
     case 5:
      fad4.setText(variabl2327.toString());
      break;
     case 6:
      fad5.setText(variabl2327.toString());
      break;
     case 7:
      fad6.setText(variabl2327.toString());
      break;
     case 8:
      fad7.setText(variabl2327.toString());
      break;
     case 9:
      fad8.setText(variabl2327.toString());
      break;
     case 10:
      fad9.setText(variabl2327.toString());
      break;
     }
    }
   }
  });

  final JButton addButton5 = new JButton("添加到表格中");
  addButton5.setBounds(50, 440, 170, 20);
  addButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1, m = 0, n1 = 0, n2 = 0, n3 = 0;
    for (int i = 0; i < variabl19655.getRowCount(); i++) {
     if ((variabl19655.getValueAt(i, 0) != null)
       && (variabl19655.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fad1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 < 0) {
     String[] rowValues = { fad1.getText(), fad2.getText(),
       fad11.getText(), fad12.getText(), fad3.getText(),
       fad4.getText(), fad5.getText(), fad6.getText(),
       fad7.getText(), fad8.getText() };
     variabl19655.addRow(rowValues);
     int rowCount = variabl26555.getRowCount() + 1;
     fad1.setText("");
     fad2.setText("0");
     fad3.setText("0");
     fad4.setText("0");
     fad5.setText("0");
     fad6.setText("0");
     fad7.setText("");
     fad8.setText("0");
     fad11.setText("0");
     fad12.setText("0");
    } else
     JOptionPane.showMessageDialog(null, "存在重复,请改按修改!");
   }
  });
  panel5.add(addButton5);

  final JButton updButton5 = new JButton("修改表格数据");
  updButton5.setBounds(220, 440, 170, 20);
  updButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = -1;
    for (int i = 0; i < variabl19655.getRowCount(); i++) {
     if ((variabl19655.getValueAt(i, 0) != null)
       && (variabl19655.getValueAt(i, 0).toString().trim()
         .equalsIgnoreCase(fad1.getText().trim()))) {
      variabl1823 = i;
      break;
     }
    }
    if (variabl1823 >= 0) {
     variabl19655.setValueAt(fad1.getText(), variabl1823, 0);
     variabl19655.setValueAt(fad2.getText(), variabl1823, 1);
     variabl19655.setValueAt(fad11.getText(), variabl1823, 2);
     variabl19655.setValueAt(fad12.getText(), variabl1823, 3);
     variabl19655.setValueAt(fad3.getText(), variabl1823, 4);
     variabl19655.setValueAt(fad4.getText(), variabl1823, 5);
     variabl19655.setValueAt(fad5.getText(), variabl1823, 6);
     variabl19655.setValueAt(fad6.getText(), variabl1823, 7);
     variabl19655.setValueAt(fad7.getText(), variabl1823, 8);
     variabl19655.setValueAt(fad8.getText(), variabl1823, 9);
     variabl19655.setValueAt(fad9.getText(), variabl1823, 10);
    } else
     JOptionPane.showMessageDialog(null, "为新数据,请改按添加!");
   }
  });
  panel5.add(updButton5);

  final JButton delButton5 = new JButton("从表格中删除");
  delButton5.setBounds(390, 440, 170, 20);
  delButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl1823 = variabl26555.getSelectedRow();
    if (variabl1823 != -1)
     variabl19655.removeRow(variabl1823);
   }
  });
  panel5.add(delButton5);

  final JButton countButton5 = new JButton("辅助计算");
  countButton5.setBounds(560, 440, 170, 20);
  countButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    int variabl2059 = variabl19655.getRowCount();
    String[][] variabl2649 = new String[variabl2059][11];
    int[][] variabl26491 = new int[variabl2059][11];
    for (int i = 0; i < variabl2059; i++) {
     for (int j = 0; j < 10; j++)
      variabl2649[i][j] = variabl19655.getValueAt(i, j)
        .toString().trim();
     for (int j = 4; j < 10; j++) {
      if (j != 8) {
       if (variabl2649[i][j].length() > 0)
        variabl26491[i][j] = Integer
          .valueOf(variabl2649[i][j]);
       else
        variabl26491[i][j] = 0;
      }
     }
     for (int j = 4; j < 8; j++) {
      if (j != 5)
       variabl26491[i][j] = variabl26491[i][j]
         * variabl26491[i][9];
      else
       variabl26491[i][j] = (int) (variabl26491[i][j]
         * variabl26491[i][9] * 1.12);
      variabl2649[i][j] = "" + variabl26491[i][j];
     }
    }

    variabl19655.setRowCount(0);
    for (int i = 0; i < variabl2059; i++)
     variabl19655.addRow(variabl2649[i]);
   }
  });
  panel5.add(countButton5);

  final JButton clearButton5 = new JButton("清参数文本框");
  clearButton5.setBounds(730, 440, 170, 20);
  clearButton5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    fad1.setText("");
    fad2.setText("0");
    fad3.setText("0");
    fad4.setText("0");
    fad5.setText("0");
    fad6.setText("0");
    fad7.setText("");
    fad8.setText("0");
    fad9.setText("");
    fad11.setText("0");
    fad12.setText("0");
   }
  });
  panel5.add(clearButton5);
  frame5.add(panel5);
  frame4.add(panel4);
  frame3.add(panel3);
  frame2.add(panel2);
  frame1.add(panel1);
  frame5.setVisible(true);
  frame4.setVisible(true);
  frame3.setVisible(true);
  frame2.setVisible(true);
  frame1.setVisible(true);
 }
}


16.源码16,部件程序:表格式报表打印预览
/*
 * 程序文件名:dataPreview1.java
 * 作者:程传庆
 * 程序功能:根据打印格式文件内容打印预览所传入的表格数据报表。
 */
import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;

public class dataPreview1 extends JComponent {
 private static JFrame frame1;
 private static String variabl1553;
 private static String s1 = "", s2 = "";
 private static int variabl1853 = 0, variabl2651 = 0;
 private static int[] variabl1489;
 private static String[][] variabl2197;
 private static ArrayList<struct1> title = new ArrayList<struct1>();
 private static ArrayList<struct2> tableTitle = new ArrayList<struct2>();
 private static ArrayList<struct3> table1 = new ArrayList<struct3>();
 private static ArrayList<struct4> table2 = new ArrayList<struct4>();
 private static ArrayList<struct5> table3 = new ArrayList<struct5>();
 private static int variabl2681 = 600;
 private static int x1 = 0, y1 = 0, w1 = 0, h1 = 0, variabl2661 = 0,
   variabl2657 = 0;
 private static Graphics2D g3;
 private static Graphics g;

 static void title() {
  struct2[] variabl2533 = new struct2[tableTitle.size()];
  variabl2661 = Integer.valueOf(tableTitle.get(0).tableTitle[3]);
  variabl2661 = variabl2661 / 2;
  for (int i = 0; i < tableTitle.size(); i++)
   variabl2533[i] = tableTitle.get(i);
  g3.setFont(new Font(variabl2533[0].tableTitle[6], Font.PLAIN, Integer
    .valueOf(variabl2533[0].tableTitle[7])));
  for (int i = 0; i < tableTitle.size(); i++) {
   x1 = variabl2661;
   y1 = variabl2657;
   w1 = Integer.valueOf(variabl2533[i].tableTitle[3]);
   h1 = Integer.valueOf(variabl2533[i].tableTitle[4]);
   g3.drawLine(x1, y1, x1 + w1, y1);
   g3.drawLine(x1, y1, x1, y1 + h1);
   g3.drawString(variabl2533[i].tableTitle[0], variabl2661 + 2,
     variabl2657 + h1);
   if (variabl2533[i].tableTitle[8].equals("有"))
    g3.drawLine(x1, y1 + h1, x1 + w1, y1 + h1);
   if (variabl2533[i].tableTitle[9].equals("有"))
    g3.drawLine(x1 + w1, y1, x1 + w1, y1 + h1);
   variabl2661 = variabl2661 + w1;
   if ((i < tableTitle.size() - 1)
     && (Integer.valueOf(variabl2533[i].tableTitle[1]) < Integer
       .valueOf(variabl2533[i + 1].tableTitle[1])))
    variabl2657 = variabl2657 + h1;
  }
  variabl2657 = variabl2657 + h1;
 }

 protected void paintComponent(Graphics g1) {
  g = g1;
  g3 = (Graphics2D) g;
  struct1[] variabl2535 = new struct1[title.size()];
  variabl2657 = 0;
  variabl2661 = 0;
  for (int i = 0; i < title.size(); i++) {
   variabl2535[i] = title.get(i);
   g3.setFont(new Font(variabl2535[i].title[8], Font.PLAIN, Integer
     .valueOf(variabl2535[i].title[9])));
   x1 = Integer.valueOf(variabl2535[i].title[6]);
   y1 = Integer.valueOf(variabl2535[i].title[7]);
   g3.drawString(variabl2535[i].title[0], x1, y1);
   variabl2657 = y1 + Integer.valueOf(variabl2535[i].title[5]);
  }
  title();
  struct3[] variabl2685 = new struct3[table1.size()];
  int[] w10 = new int[table1.size()];
  int[] h10 = new int[table1.size()];
  int[] h20 = new int[table1.size()];
  for (int i = 0; i < table1.size(); i++) {
   variabl2685[i] = table1.get(i);
   w10[i] = Integer.valueOf(variabl2685[i].table1[1]);
   h10[i] = Integer.valueOf(variabl2685[i].table1[2]);
   h20[i] = Integer.valueOf(variabl2685[i].table1[4]);
  }
  y1 = variabl2657;
  g3.setFont(new Font(variabl2685[0].table1[3], Font.PLAIN, Integer
    .valueOf(variabl2685[0].table1[4])));
  for (int j = 0; j < variabl1853; j++) {
   x1 = Integer.valueOf(tableTitle.get(0).tableTitle[3]) / 2;
   g3.drawLine(x1, y1, x1, y1 + h1);
   for (int i = 0; i < table1.size(); i++) {
    if (variabl2197[j][i] == null)
     variabl2197[j][i] = " ";
    g3.drawString(variabl2197[j][i], x1 + 2, y1 + h20[i]);
    if (variabl2685[i].table1[5].equals("有"))
     g3.drawLine(x1, y1 + h10[i], x1 + w10[i], y1 + h10[i]);
    if (variabl2685[i].table1[6].equals("有"))
     g3.drawLine(x1 + w10[i], y1, x1 + w10[i], y1 + h10[i]);
    x1 = x1 + w10[i];
   }
   y1 = y1 + h10[table1.size() - 1];
   if (y1 >= variabl2681) {
    struct4[] variabl2653 = new struct4[table2.size()];
    for (int i1 = 0; i1 < table2.size(); i1++) {
     variabl2653[i1] = table2.get(i1);
     g3.setFont(new Font(variabl2653[i1].table2[8], Font.PLAIN,
       Integer.valueOf(variabl2653[i1].table2[9])));
     x1 = Integer.valueOf(variabl2653[i1].table2[6]);
     y1 = Integer.valueOf(variabl2653[i1].table2[7]);
     g3.drawString(variabl2653[i1].table2[0], x1, y1);
     variabl2657 = y1
       + Integer.valueOf(variabl2653[i1].table2[5]);
    }
    y1 = 640;
    break;
   }
  }
  y1 = y1 + h10[table1.size() - 1];
  struct5[] variabl2665 = new struct5[table3.size()];
  for (int i = 0; i < table3.size(); i++) {
   variabl2665[i] = table3.get(i);
   g3.setFont(new Font(variabl2665[i].table3[8], Font.PLAIN, Integer
     .valueOf(variabl2665[i].table3[9])));
   x1 = Integer.valueOf(variabl2665[i].table3[6]);
   y1 = y1 + Integer.valueOf(variabl2665[i].table3[5]) / 2;
   g3.drawString(variabl2665[i].table3[0], x1, y1);
  }
 }

 /** 主程序,创建界面 */
 static void printView1(String[][] variabl21971, String variabl1537) {
  s1 = "";
  s2 = "";
  variabl1853 = 0;
  variabl2651 = 0;
  title = new ArrayList<struct1>();
  tableTitle = new ArrayList<struct2>();
  table1 = new ArrayList<struct3>();
  table2 = new ArrayList<struct4>();
  table3 = new ArrayList<struct5>();
  variabl2681 = 600;
  x1 = 0;
  y1 = 0;
  w1 = 0;
  h1 = 0;
  variabl2661 = 0;
  variabl2657 = 0;
  variabl1553 = variabl1537;
  frame1 = new JFrame("报表预览程序                          作者:程传庆");
  frame1.setBounds(10, 10, 1000, 1000);
  frame1.add(new dataPreview1());
  frame1.setVisible(true);
  File file1 = new File(variabl1553);
  try {
   if (file1.exists()) {
    FileReader fr = new FileReader(file1);
    BufferedReader br = new BufferedReader(fr);
    String tempStr = null;
    for (int i = 0; (tempStr = br.readLine()) != null; i++) {
     if (tempStr.substring(0, 2).equals("1,")) {

      title.add(new struct1(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("2,")) {
      tableTitle.add(new struct2(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("3,")) {
      table1.add(new struct3(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("4,")) {
      table2.add(new struct4(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("5,")) {
      table3.add(new struct5(tempStr.substring(2,
        tempStr.length()).split("。")));
     }
    }
   }
  } catch (IOException e2) {
   JOptionPane.showMessageDialog(null, "打开文件错!");
  }
  String s3 = "";
  for (int i = 0; i < table1.size(); i++) {
   if (s3.length() == 0)
    s3 = table1.get(i).table1[0];
   else
    s3 = s3 + "," + table1.get(i).table1[0];
  }
  variabl1853 = variabl21971.length;
  variabl2651 = variabl21971[0].length;
  variabl2197 = new String[variabl1853][variabl2651];
  for (int i = 0; i < variabl1853; i++) {
   for (int j = 0; j < variabl2651; j++)
    variabl2197[i][j] = variabl21971[i][j];
  }
 }
}

17.源码17.部件程序,表格式报表打印。
/*
 * 程序文件名:dataPrint1.java
 * 作者:程学先
 * 程序功能:根据打印格式文件内容打印预览所传入的表格数据报表。
 */
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;

public class dataPrint1 extends JFrame {
 private static String variabl1553;
 private static int variabl1853 = 0, variabl2651 = 0;
 private static String[][] variabl2197;
 private static ArrayList<struct1> title = new ArrayList<struct1>();
 private static ArrayList<struct2> tableTitle = new ArrayList<struct2>();
 private static ArrayList<struct3> table1 = new ArrayList<struct3>();
 private static ArrayList<struct4> table2 = new ArrayList<struct4>();
 private static ArrayList<struct5> table3 = new ArrayList<struct5>();
 private static int variabl2681 = 600;
 private static int x1 = 0, y1 = 0, w1 = 0, h1 = 0, variabl2661 = 0,
   variabl2657 = 0;
 private PageFormat pf;
 private static Graphics2D g2;

 static void title() {
  struct2[] variabl2533 = new struct2[tableTitle.size()];
  variabl2661 = Integer.valueOf(tableTitle.get(0).tableTitle[3]);
  variabl2661 = variabl2661 / 2;
  for (int i = 0; i < tableTitle.size(); i++)
   variabl2533[i] = tableTitle.get(i);
  g2.setFont(new Font(variabl2533[0].tableTitle[6], Font.PLAIN, Integer
    .valueOf(variabl2533[0].tableTitle[7])));
  for (int i = 0; i < tableTitle.size(); i++) {
   x1 = variabl2661;
   y1 = variabl2657;
   w1 = Integer.valueOf(variabl2533[i].tableTitle[3]);
   h1 = Integer.valueOf(variabl2533[i].tableTitle[4]);
   g2.drawLine(x1, y1, x1 + w1, y1);
   g2.drawLine(x1, y1, x1, y1 + h1);
   g2.drawString(variabl2533[i].tableTitle[0], variabl2661 + 2,
     variabl2657 + h1);
   if (variabl2533[i].tableTitle[8].equals("有"))
    g2.drawLine(x1, y1 + h1, x1 + w1, y1 + h1);
   if (variabl2533[i].tableTitle[9].equals("有"))
    g2.drawLine(x1 + w1, y1, x1 + w1, y1 + h1);
   variabl2661 = variabl2661 + w1;
   if ((i < tableTitle.size() - 1)
     && (Integer.valueOf(variabl2533[i].tableTitle[1]) < Integer
       .valueOf(variabl2533[i + 1].tableTitle[1])))
    variabl2657 = variabl2657 + h1;
  }
  variabl2657 = variabl2657 + h1;
 }

 public static void print1(String[][] variabl21971, String variabl1537) {
  variabl1853 = 0;
  variabl2651 = 0;
  title = new ArrayList<struct1>();
  tableTitle = new ArrayList<struct2>();
  table1 = new ArrayList<struct3>();
  table2 = new ArrayList<struct4>();
  table3 = new ArrayList<struct5>();
  variabl2681 = 600;
  x1 = 0;
  y1 = 0;
  w1 = 0;
  h1 = 0;
  variabl2661 = 0;
  variabl2657 = 0;
  variabl1553 = variabl1537;
  dataPrint1 frame = new dataPrint1();
  frame.setTitle("报表打印程序                                                                                                                                                                                                                                                                                                                                                      作者:程学先");
  frame.pf = new PageFormat();
  frame.pf.setOrientation(PageFormat.LANDSCAPE);
  File file1 = new File(variabl1553);
  try {
   if (file1.exists()) {
    FileReader fr = new FileReader(file1);
    BufferedReader br = new BufferedReader(fr);
    String tempStr = null;
    for (int i = 0; (tempStr = br.readLine()) != null; i++) {
     if (tempStr.substring(0, 2).equals("1,")) {

      title.add(new struct1(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("2,")) {

      tableTitle.add(new struct2(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("3,")) {

      table1.add(new struct3(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("4,")) {

      table2.add(new struct4(tempStr.substring(2,
        tempStr.length()).split("。")));
     } else if (tempStr.substring(0, 2).equals("5,")) {

      table3.add(new struct5(tempStr.substring(2,
        tempStr.length()).split("。")));
     }
    }

   }
  } catch (IOException e2) {
   JOptionPane.showMessageDialog(null, "打开文件错!");
  }
  String s3 = "";
  for (int i = 0; i < table1.size(); i++) {
   if (s3.length() == 0)
    s3 = table1.get(i).table1[0];
   else
    s3 = s3 + "," + table1.get(i).table1[0];
  }
  variabl1853 = variabl21971.length;
  variabl2651 = variabl21971[0].length;
  variabl2197 = new String[variabl1853][variabl2651];
  for (int i = 0; i < variabl1853; i++) {
   for (int j = 0; j < variabl2651; j++)
    variabl2197[i][j] = variabl21971[i][j];
  }

  final PrinterJob job = PrinterJob.getPrinterJob();
  if (!job.printDialog())
   return;

  job.setPrintable(new Printable() {
   public int print(Graphics graphics, PageFormat pageFormat,
     int pageIndex) throws PrinterException {
    if (pageIndex < 1) {
     g2 = (Graphics2D) graphics;
     g2.setStroke(new BasicStroke(1f));
     struct1[] variabl2535 = new struct1[title.size()];
     variabl2657 = 0;
     variabl2661 = 0;
     for (int i = 0; i < title.size(); i++) {
      variabl2535[i] = title.get(i);
      g2.setFont(new Font(variabl2535[i].title[8],
        Font.PLAIN, Integer
          .valueOf(variabl2535[i].title[9])));
      x1 = Integer.valueOf(variabl2535[i].title[6]);
      y1 = Integer.valueOf(variabl2535[i].title[7]);
      g2.drawString(variabl2535[i].title[0], x1, y1);
      variabl2657 = y1
        + Integer.valueOf(variabl2535[i].title[5]);
     }
     title();
     struct3[] variabl2685 = new struct3[table1.size()];
     int[] w10 = new int[table1.size()];
     int[] h10 = new int[table1.size()];
     int[] h20 = new int[table1.size()];
     for (int i = 0; i < table1.size(); i++) {
      variabl2685[i] = table1.get(i);
      w10[i] = Integer.valueOf(variabl2685[i].table1[1]);
      h10[i] = Integer.valueOf(variabl2685[i].table1[2]);
      h20[i] = Integer.valueOf(variabl2685[i].table1[4]);
     }
     y1 = variabl2657;
     for (int j = 0; j < variabl1853; j++) {
      x1 = Integer.valueOf(tableTitle.get(0).tableTitle[3]) / 2;
      g2.drawLine(x1, y1, x1, y1 + h1);
      for (int i = 0; i < table1.size(); i++) {
       if (variabl2197[j][i] == null)
        variabl2197[j][i] = " ";
       g2.drawString(variabl2197[j][i], x1 + 2, y1
         + h20[i]);
       if (variabl2685[i].table1[5].equals("有"))
        g2.drawLine(x1, y1 + h10[i], x1 + w10[i], y1
          + h10[i]);
       if (variabl2685[i].table1[6].equals("有"))
        g2.drawLine(x1 + w10[i], y1, x1 + w10[i], y1
          + h10[i]);
       x1 = x1 + w10[i];
      }
      y1 = y1 + h10[table1.size() - 1];
      if (y1 >= variabl2681) {
       struct4[] variabl2653 = new struct4[table2.size()];
       for (int i1 = 0; i1 < table2.size(); i1++) {
        variabl2653[i1] = table2.get(i1);
        g2.setFont(new Font(
          variabl2653[i1].table2[8],
          Font.PLAIN,
          Integer.valueOf(variabl2653[i1].table2[9])));
        x1 = Integer.valueOf(variabl2653[i1].table2[6]);
        y1 = Integer.valueOf(variabl2653[i1].table2[7]);
        g2.drawString(variabl2653[i1].table2[0], x1, y1);
        variabl2657 = y1
          + Integer
            .valueOf(variabl2653[i1].table2[5]);
       }
       y1 = 640;
       break;
      }
     }
     y1 = y1 + h10[table1.size() - 1];
     struct5[] variabl2665 = new struct5[table3.size()];
     for (int i = 0; i < table3.size(); i++) {
      variabl2665[i] = table3.get(i);
      g2.setFont(new Font(variabl2665[i].table3[8],
        Font.PLAIN, Integer
          .valueOf(variabl2665[i].table3[9])));
      x1 = Integer.valueOf(variabl2665[i].table3[6]);
      y1 = y1 + Integer.valueOf(variabl2665[i].table3[5]) / 2;
      g2.drawString(variabl2665[i].table3[0], x1, y1);
     }
     return Printable.PAGE_EXISTS;
    } else {
     return Printable.NO_SUCH_PAGE;
    }
   }
  });
  try {
   job.print();
  } catch (Exception e1) {
   e1.printStackTrace();
  }
  frame.dispose();
 }
}

18.源码18.部件程序,定查询条件表达式的多数据表单一条件或二条件查询程序,可变换标签,可分组统计,可按格式打印报表。
/**
 * 程序文件名:dataQuery9.java
 * 作者:程学先
 * 完成时间:2013年11月27日
 * 部件功能:在参数中直接给定查询条件表达式的主题部分和输出要求多表单条件或二条件查询程序,
 * 程序允许利用字典表做标签的变换。
 * 可按格式文件组织打印。运行时程序提供单个或二个文本框供输入查询数据,之后组织查询。
 */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.sql.*;

public class dataQuery9 extends JFrame {
 static dataQuery9 frame = new dataQuery9();
 static String variabl2603;
 static String variabl1873;
 static String variabl2429;
 static DefaultTableModel tableModel;
 static JTable table;
 static JScrollPane scrollPane = new JScrollPane();
 static JTextField aTextField, aTextField2;
 static JButton b1, b2;
 static String s1 = "";
 static ResultSet rs;
 static int b = 0, c = 0;
 static int variabl2651;
 static int variabl2113;
 static String[][] variabl2517;
 static String variabl1269 = "", variabl1787 = "", variabl17871 = "";
 static String[][] variabl2319 = { { " > ", "大于" }, { " < ", "小于" },
   { " = ", "等于" }, { " >= ", "大于等于" }, { " <= ", "小于等于" },
   { "<>", "不等于" }, { " like ", "包含" }, { " not like ", "不包含" } };
 static String[] variabl2411;
 static String[] variabl1501;
 static String[] variabl1169;
 static int[] variabl1489;
 static int[] variabl1119;
 static int variabl1853, variabl18531;
 static String[][] variabl2197;
 static int variabl2345 = 0, variabl23451 = 0;
 static String variabl2049;
 static String variabl2259 = "", variabl22591 = "", variabl2485 = "",
   variabl22590 = "", variabl225901 = "";
 static String variabl2385 = "", variabl23851 = "";
 static String variabl1413;
 static String variabl1325;
 static String[] variabl1735;
 static int variabl2337 = 80;
 static String[] variabl2669;
 static String variabl2101;
 static String variabl1079;
 static Connection con;
 static ResultSetMetaData rsmd3;
 static Statement sta3;
 static int variabl2483 = 1000, variabl2503 = 600;
 static int variabl2851 = 0, variabl2339 = 0;
 static String[] variabl2405 = null;
 static String variabl1187;
 static JButton printViewButton, printButton;

 public static void means(final String[] parameter) {
  frame = new dataQuery9();
  scrollPane = new JScrollPane();
  s1 = "";
  b = 0;
  c = 0;
  variabl1269 = "";
  variabl1787 = "";
  variabl17871 = "";
  variabl2345 = 0;
  variabl23451 = 0;
  variabl2259 = "";
  variabl22591 = "";
  variabl2485 = "";
  variabl22590 = "";
  variabl225901 = "";
  variabl2385 = "";
  variabl23851 = "";
  variabl2483 = 1000;
  variabl2503 = 600;
  variabl2319[0][0] = " > ";
  variabl2319[0][1] = "大于";
  variabl2319[1][0] = " < ";
  variabl2319[1][1] = "小于";
  variabl2319[2][0] = " = ";
  variabl2319[2][1] = "等于";
  variabl2319[3][0] = " >= ";
  variabl2319[3][1] = "大于等于";
  variabl2319[4][0] = " <= ";
  variabl2319[4][1] = "小于等于";
  variabl2319[5][0] = " <> ";
  variabl2319[5][1] = "不等于";
  variabl2319[6][0] = " like ";
  variabl2319[6][1] = "包含";
  variabl2319[7][0] = " not like ";
  variabl2319[7][1] = "不包含";
  String[] variabl240501 = { "查询", "打印预览", "打印", "退出" };
  variabl2405 = new String[variabl240501.length];
  variabl2851 = 0;
  for (int i0 = 0; i0 < variabl240501.length; i0++)
   variabl2405[i0] = variabl240501[i0];
  if (parameter[11].length() > 0) {
   variabl1187 = parameter[11];
   variabl1187 = variabl1187.replaceAll(";", ";");
   variabl1187 = variabl1187.replaceAll("。", ";");
   variabl1187 = variabl1187.replaceAll(":", ";");
   variabl1187 = variabl1187.replaceAll(":", ";");
   if (variabl1187.indexOf(";") > 0) {
    String s601[] = variabl1187.split(",");
    variabl1187 = "";
    for (int i01 = 0; i01 < s601.length; i01++) {
     if (s601[i01].indexOf(";") > 0) {
      String s602[] = s601[i01].split(";");
      variabl2405[Integer.parseInt((s602[0]))] = s602[1];
      variabl1187 = variabl1187 + "," + s602[0];
      variabl2851++;
     } else {
      variabl1187 = variabl1187 + "," + s601[i01];
      variabl2851++;
     }
    }
   } else {
    String s601[] = variabl1187.split(",");
    variabl1187 = "";
    for (int i01 = 0; i01 < s601.length; i01++) {
     if (i01 == 0)
      variabl1187 = s601[i01];
     else
      variabl1187 = variabl1187 + "," + s601[i01];
     variabl2851++;
    }
   }
  } else {
   variabl1187 = "";
   for (int i1 = 0; i1 < variabl2405.length; i1++) {
    if (i1 == 0)
     variabl1187 = variabl1187 + i1;
    else
     variabl1187 = variabl1187 + "," + i1;
    variabl2851++;
   }
  }
  variabl1187 = "," + variabl1187 + ",";
  variabl2483 = main1.variabl2483;
  variabl2503 = main1.variabl2503;
  int m1, m2;
  try {
   if (parameter[17].length() == 0) {
    m1 = 0;
    m2 = 0;
   } else {
    m1 = Integer.parseInt(parameter[17]);
    m2 = Integer.parseInt(parameter[18]);
   }
   if (m1 > 0) {
    if (m2 < 80) {
     m1 = m1 * 10;
     m2 = m2 * 10;
    }
    variabl2483 = m1;
    variabl2503 = m2;
   }
  } catch (Exception e2) {
  }

  variabl2603 = parameter[4];
  variabl2049 = parameter[20];
  variabl1079 = parameter[15];
  variabl1325 = parameter[19];
  if (variabl1325.lastIndexOf(",") == variabl1325.length() - 1)
   variabl1325 = variabl1325.substring(0, variabl1325.length() - 1);
  String[] s6 = variabl1325.split(",");
  String s2 = "";
  if (parameter[8].length() > 0) {
   variabl1735 = parameter[8].split(",");
   variabl2517 = new String[2][variabl1735.length];
   for (int i = 0; i < variabl1735.length; i++) {
    variabl2517[0][i] = s6[Integer.parseInt(variabl1735[i])];
    variabl2517[1][i] = variabl2517[0][i];
    if (s2.length() > 0)
     s2 = s2 + "," + variabl2517[0][i];
    else
     s2 = variabl2517[0][i];
   }
   variabl1325 = s2;
  } else {
   variabl2517 = new String[2][s6.length];
   for (int i = 0; i < s6.length; i++) {
    variabl2517[0][i] = s6[i];
    variabl2517[1][i] = variabl2517[0][i];
    if (s2.length() > 0)
     s2 = s2 + "," + variabl2517[0][i];
    else
     s2 = variabl2517[0][i];
   }
   variabl1325 = s2;
   s2 = " * ";
  }
  String s11 = variabl2603;
  if (variabl2603.indexOf(",") > 0) {
   String[] s12 = variabl2603.split(",");
   s11 = s12[0];
  }
  variabl2429 = parameter[0];
  variabl1873 = "";
  variabl1079 = parameter[15];
  variabl1413 = parameter[10];
  variabl2101 = parameter[14];
  String[] t1;
  variabl1873 = "";
  if (variabl2429.lastIndexOf(s11 + "字典表") > 0) {
   t1 = variabl2429.split(",");
   for (int i = 0; i < t1.length; i++)
    if (t1[i].lastIndexOf(s11 + "字典表") >= 0)
     variabl1873 = t1[i];
  }
  if (variabl1873.length() > 0) {
   try {
    con = main1.getConn();
    sta3 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
      ResultSet.CONCUR_UPDATABLE);
    s1 = "select * from " + variabl1873;
    rs = sta3.executeQuery(s1);
    ResultSetMetaData rsmd = rs.getMetaData();
    int variabl26510 = rsmd.getColumnCount();

    int numberOfColumns = rsmd.getColumnCount();
    String s14 = "";
    String s15 = "";
    int b = 1;
    while (rs.absolute(b)) {
     b++;
     s14 = rs.getString(1).trim();
     s15 = rs.getString(2).trim();
     for (int j = 0; j < variabl2517[0].length; j++) {
      if (variabl2517[0][j].trim().equalsIgnoreCase(
        s14.trim())) {
       variabl2517[1][j] = s15;
       break;
      } else if ((variabl2517[0][j].trim() + ",").indexOf("."
        + s14 + ",") > 0) {
       variabl2517[1][j] = variabl2517[1][j].replace(s14,
         s15);
       break;
      }
     }
    }
    rs.close();
    con.close();
    sta3.close();
   } catch (SQLException e) {
    JOptionPane.showMessageDialog(null, "连接数据库出错!");
   }
  }
  String[] g2, g3;
  if (variabl1413.lastIndexOf("与") > 0) {
   variabl2669 = variabl1413.split("与");
   variabl2485 = " and ";
  } else if (variabl1413.lastIndexOf("或者") > 0) {
   variabl2669 = variabl1413.split("或者");
   variabl2485 = " or ";
  } else {
   variabl2669 = new String[1];
   variabl2669[0] = variabl1413;
  }

  if (variabl2669[0].lastIndexOf("大于等于") > 0) {
   variabl22590 = ">=";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("大于等于"));
  } else if (variabl2669[0].lastIndexOf("小于等于") > 0) {
   variabl22590 = "<=";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("小于等于"));
  } else if (variabl2669[0].lastIndexOf("不等于") > 0) {
   variabl22590 = "!=";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("不等于"));
  } else if (variabl2669[0].lastIndexOf("大于") > 0) {
   variabl22590 = ">";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("大于"));
  } else if (variabl2669[0].lastIndexOf("小于") > 0) {
   variabl22590 = "<";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("小于"));
  } else if (variabl2669[0].lastIndexOf("等于") > 0) {
   variabl22590 = "=";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("等于"));
  } else if (variabl2669[0].lastIndexOf("不包含") > 0) {
   variabl22590 = "不包含";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("不包含"));
  } else if (variabl2669[0].lastIndexOf("包含") > 0) {
   variabl22590 = "包含";
   variabl2385 = variabl2669[0].substring(0,
     variabl2669[0].lastIndexOf("包含"));
  }
  if (variabl2485.length() > 0) {
   if (variabl2669[1].lastIndexOf("大于等于") > 0) {
    variabl225901 = ">=";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("大于等于"));
   } else if (variabl2669[1].lastIndexOf("小于等于") > 0) {
    variabl225901 = "<=";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("小于等于"));
   } else if (variabl2669[1].lastIndexOf("不等于") > 0) {
    variabl225901 = "!=";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("不等于"));
   } else if (variabl2669[1].lastIndexOf("大于") > 0) {
    variabl225901 = ">";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("大于"));
   } else if (variabl2669[1].lastIndexOf("小于") > 0) {
    variabl225901 = "<";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("小于"));
   } else if (variabl2669[1].lastIndexOf("等于") > 0) {
    variabl225901 = "=";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("等于"));
   } else if (variabl2669[1].lastIndexOf("不包含") > 0) {
    variabl225901 = "不包含";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("不包含"));
   } else if (variabl2669[1].lastIndexOf("包含") > 0) {
    variabl225901 = "包含";
    variabl23851 = variabl2669[1].substring(0,
      variabl2669[1].lastIndexOf("包含"));
   }
  }
  try {
   con = main1.getConn();
   sta3 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
     ResultSet.CONCUR_UPDATABLE);

   if (variabl2049.trim().length() > 0)
    s1 = "select " + variabl1325 + " from " + variabl2603
      + " where " + variabl2049;
   else
    s1 = "select " + variabl1325 + " from " + variabl2603;
   ResultSet rs = sta3.executeQuery(s1);
   rsmd3 = rs.getMetaData();
   variabl2651 = rsmd3.getColumnCount();
   variabl1501 = new String[variabl2651];
   variabl1489 = new int[variabl2651];
   for (int i = 0; i < variabl2651; i++) {
    if ((variabl2385.length() > 0)
      && (variabl2517[0][i].trim()
        .equalsIgnoreCase(variabl2385.trim())))
     variabl2345 = i;
    else if ((variabl2517[0][i].trim() + ",").indexOf("."
      + variabl2385.trim() + ",") > 0)
     variabl2345 = i;
    if ((variabl23851.length() > 0)
      && (variabl2517[0][i].trim()
        .equalsIgnoreCase(variabl23851.trim())))
     variabl23451 = i;
    else if ((variabl2517[0][i].trim() + ",").indexOf("."
      + variabl23851.trim() + ",") > 0)
     variabl23451 = i;
    variabl1501[i] = rsmd3.getColumnTypeName(i + 1);
    variabl1489[i] = rsmd3.getColumnDisplaySize(i + 1);
    if (variabl1489[i] < variabl2517[0][i].length())
     variabl1489[i] = variabl2517[0][i].length();
    if (variabl1489[i] > 50)
     variabl1489[i] = 50;
    b++;
   }

   int rowNumber = 0;
   rs.last();
   rowNumber = rs.getRow();
   variabl2197 = new String[rowNumber][variabl2651];
   rs.absolute(1);
   c = 0;
   b = 0;
   while (c < rowNumber) {
    rs.absolute(c + 1);
    while (b < variabl2651) {
     variabl2197[c][b] = rs.getString(b + 1);
     b++;
    }
    c++;
    b = 0;
   }
   rs.close();
   sta3.close();
   con.close();
  } catch (SQLException e) {
   JOptionPane.showMessageDialog(null, "查询数据出错!" + s1);
  }

  if (variabl2049.trim().length() > 0)
   variabl2049 = variabl2049 + " and ";

  frame.setTitle("查询部件程序                                作者:程学先");
  frame.setBounds(10, 10, variabl2483 - 10, variabl2503 - 10);
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.getContentPane().setLayout(null);
  final JPanel panel = new JPanel(false);
  panel.setLayout(null);
  panel.setBounds(20, 20, variabl2483 - 50, variabl2503 - 20);

  tableModel = new DefaultTableModel(variabl2197, variabl2517[1]);
  table = new JTable(tableModel);
  table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  scrollPane.getViewport().add(table, null);
  scrollPane.setBounds(30, 60, variabl2483 - 100, variabl2503 - 200);
  for (int i = 0; i < variabl2651; i++) {
   TableColumn tc = table.getColumn(variabl2517[1][i]);
   tc.setPreferredWidth(variabl1489[i] * 12);
  }
  panel.add(scrollPane);
  JLabel label1 = new JLabel(variabl2669[0]);
  label1.setBounds(variabl2337, 10, variabl2669[0].length() * 15, 20);
  panel.add(label1);
  variabl2337 = variabl2337 + variabl2669[0].length() * 15;

  aTextField = new JTextField("", 10);
  aTextField.setBounds(variabl2337, 10, 100, 20);
  panel.add(aTextField);
  variabl2337 = variabl2337 + 100;

  if (variabl2669.length > 1) {
   JLabel label3 = new JLabel(variabl2669[1]);
   label3.setBounds(variabl2337, 10, variabl2669[1].length() * 15, 20);
   panel.add(label3);
   variabl2337 = variabl2337 + variabl2669[1].length() * 15;

   aTextField2 = new JTextField("", 10);
   aTextField2.setBounds(variabl2337, 10, 150, 20);
   panel.add(aTextField2);
  }
  variabl2339 = (variabl2483 - 360) / variabl2851;
  int variabl2337 = 350;
  final JButton selectButton = new JButton(variabl2405[0]);
  selectButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    String[] s8 = null;
    int c = 0;
    String variabl21010 = "";
    try {
     con = main1.getConn();
     sta3 = con.createStatement(
       ResultSet.TYPE_SCROLL_INSENSITIVE,
       ResultSet.CONCUR_UPDATABLE);
     if (variabl2101.trim().length() < 1)
      variabl2101 = variabl1325;
     s1 = "select " + variabl2101 + " from " + variabl2603;
     if (variabl2049.trim().length() > 0)
      s1 = s1 + " where " + variabl2049
        + variabl2517[0][variabl2345];
     else
      s1 = s1 + " where " + variabl2517[0][variabl2345];

     if (((main1.variabl1539.lastIndexOf(","
       + variabl1501[variabl2345] + ",")) >= 0)
       || ((main1.variabl1539.lastIndexOf(","
         + variabl1501[variabl23451] + ",")) >= 0)) {
      JOptionPane.showMessageDialog(null,
        "不允许使用图形与二进制数据类型作为查询条件!", "提示",
        JOptionPane.INFORMATION_MESSAGE);
      return;
     }
     if (variabl22590.lastIndexOf("包含") < 0) {
      if (main1.variabl1545.lastIndexOf(","
        + variabl1501[variabl2345] + ",") >= 0)
       s1 = s1 + variabl22590
         + aTextField.getText().trim();
      else
       s1 = s1 + variabl22590 + "'"
         + aTextField.getText().trim() + "'";
     } else {
      if (main1.variabl1545.lastIndexOf(","
        + variabl1501[variabl2345] + ",") >= 0) {
       JOptionPane.showMessageDialog(null,
         "数字类数据类型不能做包含查询!");
       return;
      } else if (variabl22590.lastIndexOf("不包含") >= 0)
       s1 = s1 + " not like '%"
         + aTextField.getText().trim() + "%'";
      else
       s1 = s1 + " like '%" + aTextField.getText().trim()
         + "%'";
     }
     if (variabl2669.length > 1) {
      if (variabl225901.lastIndexOf("包含") < 0)
       if (main1.variabl1545.lastIndexOf(","
         + variabl1501[variabl23451] + ",") >= 0)
        s1 = s1 + " and "
          + variabl2517[0][variabl23451]
          + variabl225901
          + aTextField2.getText().trim();
       else
        s1 = s1 + " and "
          + variabl2517[0][variabl23451]
          + variabl225901 + "'"
          + aTextField2.getText().trim() + "'";
      else if (main1.variabl1545.lastIndexOf(","
        + variabl1501[variabl23451] + ",") >= 0) {
       JOptionPane.showMessageDialog(null,
         "数字类数据类型不能做包含查询!");
       return;
      } else if (variabl225901.lastIndexOf("不包含") >= 0)
       s1 = s1 + " and " + variabl2517[0][variabl23451]
         + " not like '%"
         + aTextField2.getText().trim() + "%'";
      else
       s1 = s1 + " and " + variabl2517[0][variabl23451]
         + " like '%" + aTextField2.getText().trim()
         + "%'";
     }
     if (parameter[9].trim().length() > 0) {
      String[] s0 = parameter[9].split(",");
      String s2 = "";
      for (int k = 0; k < s0.length; k++)
       if (k < s0.length - 1)
        s2 = s2
          + variabl2517[0][Integer
            .parseInt(s0[k])] + ",";
       else
        s2 = s2
          + variabl2517[0][Integer
            .parseInt(s0[k])];
      s1 = s1 + " group by " + s2;
     }
     ResultSet rs = sta3.executeQuery(s1);
     int rowNumber = 0;
     rs.last();
     rowNumber = rs.getRow();
     rsmd3 = rs.getMetaData();
     int variabl26510 = rsmd3.getColumnCount();
     variabl1489 = new int[variabl26510];
     String[][] variabl25170 = new String[2][variabl26510];
     for (int i = 0; i < variabl26510; i++) {
      variabl25170[0][i] = rsmd3.getColumnName(i + 1);
      variabl25170[1][i] = rsmd3.getColumnName(i + 1);
      variabl1489[i] = rsmd3.getColumnDisplaySize(i + 1);
      if (variabl1489[i] < variabl25170[1][i].length())
       variabl1489[i] = variabl25170[1][i].length();
      if (variabl1489[i] > 50)
       variabl1489[i] = 50;
     }
     String s4 = "";
     for (int i = 0; i < variabl26510; i++) {
      s4 = variabl25170[1][i];
      for (int j = 0; j < variabl2651; j++) {
       if (variabl2517[0][j].trim().equalsIgnoreCase(
         s4.trim())) {
        variabl25170[1][i] = s4;
        break;
       }
      }
     }
     variabl2197 = new String[rowNumber][variabl26510];
     c = 0;
     b = 0;
     while (c < rowNumber) {
      rs.absolute(c + 1);
      while (b < variabl26510) {
       variabl2197[c][b] = rs.getString(b + 1);
       b++;
      }
      c++;
      b = 0;
     }
     rs.close();
     sta3.close();
     con.close();
     tableModel = new DefaultTableModel(variabl2197,
       variabl25170[1]);
     table = new JTable(tableModel);
     table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
     scrollPane.setViewportView(table);
    } catch (Exception e1) {
     JOptionPane.showMessageDialog(null, "查询数据出错!" + s1);
    }
    printViewButton.setEnabled(true);
    printButton.setEnabled(true);
   }
  });
  selectButton.setBounds(variabl2337, 30, variabl2339, 20);
  if (variabl1187.indexOf(",0,") >= 0) {
   variabl2337 = variabl2337 + variabl2339;
   panel.add(selectButton);
  }

  printViewButton = new JButton(variabl2405[1]);
  printViewButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    dataPreview1.printView1(variabl2197, variabl1079);
   }
  });
  printViewButton.setBounds(variabl2337, 30, variabl2339, 20);
  if (variabl1187.indexOf(",1,") >= 0) {
   variabl2337 = variabl2337 + variabl2339;
   panel.add(printViewButton);
   printViewButton.setEnabled(false);
  }

  printButton = new JButton(variabl2405[2]);
  printButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    dataPrint1.print1(variabl2197, variabl1079);
   }
  });
  printButton.setBounds(variabl2337, 30, variabl2339, 20);
  if (variabl1187.indexOf(",2,") >= 0) {
   variabl2337 = variabl2337 + variabl2339;
   panel.add(printButton);
   printButton.setEnabled(false);
  }

  final JButton exitButton = new JButton(variabl2405[3]);
  exitButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
    panel.setVisible(false);
    frame.setVisible(false);
    frame.dispose();
   }
  });
  exitButton.setBounds(variabl2337, 30, variabl2339, 20);
  if (variabl1187.indexOf(",3,") >= 0) {
   variabl2337 = variabl2337 + variabl2339;
   panel.add(exitButton);
  }

  frame.getContentPane().add(panel, null);
  frame.setVisible(true);
  frame.getContentPane().add(panel, BorderLayout.SOUTH);
 }

 public static String[] getArray(String str) {
  String[] array;
  String s1 = str;
  int i = 1;
  while (s1.indexOf(",") != -1) {
   s1 = s1.substring(s1.indexOf(",") + 1, s1.length());
   i++;
  }
  array = new String[i];
  int j = 0;
  while (str.indexOf(",") != -1) {
   array[j] = str.substring(0, str.indexOf(","));
   str = str.substring(str.indexOf(",") + 1, str.length());
   array[j + 1] = str;
   j++;
  }
  return array;
 }
}



https://blog.sciencenet.cn/blog-2551-1116176.html

上一篇:管理信息系统软件生产线源码9-14
下一篇:管理信息系统软件生产线源码19-23
收藏 IP: 183.94.47.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-13 13:27

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部