JF_view_buy.java
上传用户:whbcdz
上传日期:2008-08-04
资源大小:7683k
文件大小:22k
源码类别:

JavaScript

开发平台:

Java

  1. package appjxc.view;
  2. import javax.swing.*;
  3. import java.awt.BorderLayout;
  4. import java.awt.*;
  5. import javax.swing.BorderFactory;
  6. import javax.swing.table.DefaultTableModel;
  7. import javax.swing.table.DefaultTableColumnModel;
  8. import javax.swing.table.TableColumnModel;
  9. import java.awt.event.ActionEvent;
  10. import java.awt.event.ActionListener;
  11. import java.util.Locale;
  12. import java.text.DateFormat;
  13. import java.util.List;
  14. import appjxc.dao.AdapterDao;
  15. import java.util.Iterator;
  16. import java.awt.event.ItemListener;
  17. import java.awt.event.ItemEvent;
  18. import appjxc.model.obj_medicine;
  19. import appjxc.model.Obj_client;
  20. import javax.swing.event.TableModelListener;
  21. import appjxc.model.Obj_SellMain;
  22. import appjxc.model.Obj_SellDetaile;
  23. import java.awt.Font;
  24. import java.util.Calendar;
  25. import java.awt.event.KeyEvent;
  26. import java.awt.event.KeyAdapter;
  27. import appjxc.model.Obj_gys;
  28. import appjxc.model.Obj_BuyMain;
  29. import appjxc.model.Obj_BuyDetaile;
  30. public class JF_view_buy extends JInternalFrame implements TableModelListener{
  31.     BorderLayout borderLayout1 = new BorderLayout();
  32.     JPanel jPanel1 = new JPanel();
  33.     JPanel jPanel2 = new JPanel();
  34.     JLabel jLabel1 = new JLabel();
  35.     JTextField jTxszl = new JTextField();
  36.     JLabel jLabel2 = new JLabel();
  37.     JTextField jTxssl = new JTextField();
  38.     JLabel jLabel3 = new JLabel();
  39.     JTextField jThjje = new JTextField();
  40.     JSplitPane jSplitPane1 = new JSplitPane();
  41.     BorderLayout borderLayout2 = new BorderLayout();
  42.     JPanel jPanel4 = new JPanel();
  43.     JPanel jPanel5 = new JPanel();
  44.     GridLayout gridLayout2 = new GridLayout();
  45.     JLabel jLabel9 = new JLabel();
  46.     JTextField jTxsph = new JTextField();
  47.     JLabel jLabel10 = new JLabel();
  48.     JTextField jTldrq = new JTextField();
  49.     JLabel jLabel11 = new JLabel();
  50.     JLabel jLabel12 = new JLabel();
  51.     JTextField jTjbr = new JTextField();
  52.     FlowLayout flowLayout1 = new FlowLayout();
  53.     JButton jBadd = new JButton();
  54.     JButton jBsave = new JButton();
  55.     JButton jButton3 = new JButton();
  56.     JComboBox jComboBox1 = new JComboBox();
  57.     BorderLayout borderLayout3 = new BorderLayout();
  58.     JScrollPane jScrollPane1 = new JScrollPane();
  59.     JTable jTable1 = new JTable();
  60.     DefaultTableModel tableModel = null;
  61.     JComboBox jcbh = new JComboBox();
  62.     JComboBox jComboBox21 = new JComboBox();
  63.     JButton jBreg = new JButton();
  64.     JButton jBdel = new JButton();
  65.     private Calendar calendar;
  66.     public JF_view_buy() {
  67.         try {
  68.             buildTable();
  69.             jbInit();
  70.         } catch (Exception ex) {
  71.             ex.printStackTrace();
  72.         }
  73.     }
  74.     public void buildTable(){
  75.         String[] tname = {"流水号","药品编号","药品名称","药品批号","规格","产地","单位","进货价格","进货数量","进货金额","零售价","有效期至"};
  76.         java.util.Vector vname = new java.util.Vector();
  77.         for (int i = 0 ; i < tname.length ; i++){
  78.             vname.addElement(tname[i]);
  79.         }
  80.         tableModel = new DefaultTableModel(vname,0);
  81.         tableModel.addTableModelListener(this);
  82.         jTable1.setModel(tableModel);
  83.         TableColumnModel tcm = jTable1.getColumnModel();
  84.     }
  85.     private void jbInit() throws Exception {
  86.         tableModel.addTableModelListener(this);
  87.         this.getContentPane().setLayout(borderLayout1);
  88.         jPanel1.setLayout(borderLayout2);
  89.         jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
  90.         jSplitPane1.setVerifyInputWhenFocusTarget(false);
  91.         jPanel4.setLayout(gridLayout2);
  92.         gridLayout2.setColumns(4);
  93.         gridLayout2.setRows(4);
  94.         jLabel9.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  95.         jLabel9.setHorizontalAlignment(SwingConstants.LEFT);
  96.         jLabel9.setText("采购票号");
  97.         jTxsph.setText("");
  98.         jLabel10.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  99.         jLabel10.setText("录单日期");
  100.         jTldrq.setText("");
  101.         jLabel11.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  102.         jLabel11.setToolTipText("");
  103.         jLabel11.setText("供应商名称");
  104.         jLabel12.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  105.         jLabel12.setText("经办人");
  106.         jTjbr.setText("");
  107.         jPanel5.setLayout(flowLayout1);
  108.         jBadd.setEnabled(false);
  109.         jBadd.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  110.         jBadd.setText("添加");
  111.         jBadd.addActionListener(new JF_view_buy_jBadd_actionAdapter(this));
  112.         jBsave.setEnabled(false);
  113.         jBsave.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  114.         jBsave.setText("存盘");
  115.         jBsave.addActionListener(new JF_view_buy_jBsave_actionAdapter(this));
  116.         jButton3.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  117.         jButton3.setText("退出");
  118.         jButton3.addActionListener(new JF_view_buy_jButton3_actionAdapter(this));
  119.         jPanel2.setLayout(borderLayout3);
  120.         jPanel2.setBorder(BorderFactory.createLoweredBevelBorder());
  121.         flowLayout1.setAlignment(FlowLayout.RIGHT);
  122.         jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.
  123.                                                   HORIZONTAL_SCROLLBAR_ALWAYS);
  124.         jTable1.setAutoscrolls(false);
  125.         jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
  126.         this.setClosable(true);
  127.         this.setMaximizable(true);
  128.         this.setTitle("医药进销存管理系统-[药品入库]");
  129.         jBreg.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  130.         jBreg.setText("登记");
  131.         jBreg.addActionListener(new JF_view_buy_jBreg_actionAdapter(this));
  132.         jLabel1.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  133.         jLabel2.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  134.         jLabel3.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  135.         jBdel.setEnabled(false);
  136.         jBdel.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  137.         jBdel.setText("删除");
  138.         jBdel.addActionListener(new JF_view_buy_jBdel_actionAdapter(this));
  139.         jTxszl.setEnabled(false);
  140.         jTxssl.setEnabled(false);
  141.         jThjje.setEnabled(false);
  142.         jComboBox1.setFont(new java.awt.Font("新宋体", Font.PLAIN, 12));
  143.         this.getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
  144.         jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
  145.         jScrollPane1.getViewport().add(jTable1);
  146.         jLabel1.setText("采购品种");
  147.         jTxszl.setText("");
  148.         jLabel2.setText("采购总数");
  149.         jTxssl.setText("");
  150.         jLabel3.setText("合计金额");
  151.         jThjje.setText("");
  152.         this.getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
  153.         jPanel1.add(jSplitPane1, java.awt.BorderLayout.CENTER);
  154.         jSplitPane1.add(jPanel4, JSplitPane.TOP);
  155.         jPanel4.add(jLabel9);
  156.         jPanel4.add(jTxsph);
  157.         jPanel4.add(jLabel10);
  158.         jPanel4.add(jTldrq);
  159.         jPanel4.add(jLabel11);
  160.         jPanel4.add(jComboBox1);
  161.         jPanel4.add(jLabel1);
  162.         jPanel4.add(jTxszl);
  163.         jPanel4.add(jLabel12);
  164.         jPanel4.add(jTjbr);
  165.         jPanel4.add(jLabel2);
  166.         jPanel4.add(jTxssl);
  167.         jPanel4.add(jLabel3);
  168.         jPanel4.add(jThjje);
  169.         jSplitPane1.add(jPanel5, JSplitPane.BOTTOM);
  170.         jPanel5.add(jBreg);
  171.         jPanel5.add(jBadd);
  172.         jPanel5.add(jBdel);
  173.         jPanel5.add(jBsave);
  174.         jPanel5.add(jButton3);
  175.         setSize(850,550);
  176.         setVisible(true);
  177.         //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
  178.         UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
  179.         SwingUtilities.updateComponentTreeUI(this);
  180.     }
  181.     public void jBadd_actionPerformed(ActionEvent e) {
  182.         /*-----添加药品详细记录-------*/
  183.        java.util.Vector vdata = new java.util.Vector();
  184.        String lsh = new appjxc.constrol.GenalLsh().getLsh();
  185.        vdata.addElement(lsh);
  186.        tableModel.addRow(vdata);
  187.        jTable1.setModel(tableModel);
  188.        //此处简洁处理为一次读入完成之后,在进行登记添加的时候不进行读取以提高效率
  189.        if (jcbh.getItemCount() <= 0 ) {
  190.            String queryStr = "";
  191.            queryStr = "select m.ypbh from obj_medicine m";
  192.            List list = AdapterDao.QueryObject(queryStr);
  193.            Iterator iterator = list.iterator();
  194.            jcbh.removeAllItems();
  195.            while (iterator.hasNext()) {
  196.                jcbh.addItem(iterator.next());
  197.            }
  198.            jcbh.addItemListener(new JF_view_buy_jcbh_itemAdapter(this));
  199.        }
  200.        TableColumnModel tcm = jTable1.getColumnModel();
  201.        tcm.getColumn(0).setPreferredWidth(140);
  202.        tcm.getColumn(1).setCellEditor(new DefaultCellEditor(jcbh));
  203.        jTable1.setRowHeight(20);
  204.        jTable1.requestFocus();
  205.        jBdel.setEnabled(true);
  206.        jBsave.setEnabled(true);
  207.     }
  208.     public void tableChanged(javax.swing.event.TableModelEvent e){
  209.         int row = e.getFirstRow();
  210.         int col = e.getColumn();
  211.         if (col == 8){ //为进货数量
  212.             Object obj = jTable1.getValueAt(row,col);
  213.             int jhsl;
  214.             float jhdj,jhje;
  215.             jhdj = Float.parseFloat(String.valueOf(jTable1.getValueAt(row,7)).trim());
  216.             jhsl = Integer.parseInt(String.valueOf(obj).trim());
  217.             jhje = jhdj * jhsl;
  218.             System.out.println("jhsl" +  jhsl + ";jhdj" + jhdj + ";jhje" + jhje);
  219.             jTable1.setValueAt(String.valueOf(jhje),row,9);
  220.             jTxszl.setText(String.valueOf(jTable1.getRowCount())); //销售品种数
  221.             int xszs = 0;
  222.             float hjje = 0;
  223.             for (int i = 0 ; i < jTable1.getRowCount() ; i++){
  224.                 xszs = xszs + Integer.parseInt(String.valueOf(jTable1.getValueAt(i,8)).trim());
  225.                 hjje = hjje + Float.parseFloat(String.valueOf(jTable1.getValueAt(i,9)).trim());
  226.             }
  227.             jTxssl.setText(String.valueOf(xszs)); //销售总数
  228.             jThjje.setText(String.valueOf(hjje)); //合计金额
  229.         }
  230. //
  231.     }
  232.     public void jcbh_itemStateChanged(ItemEvent itemEvent) {
  233.             String bh;
  234.             Object obj = jcbh.getSelectedItem();
  235.             if (obj == null)return;
  236.             int row;
  237.             row = jTable1.getSelectedRow();
  238.             if (row < 0 ) return;
  239.             bh = obj.toString();
  240.             String queryStr;
  241.             queryStr = "from obj_medicine m where m.ypbh = '" + bh + "'";
  242.             List list = AdapterDao.QueryObject(queryStr);
  243.             Iterator iterator = list.iterator();
  244.             while (iterator.hasNext()) {
  245.                 obj_medicine objm = (obj_medicine) iterator.next();
  246.                 jTable1.setValueAt(objm.getYpmc(), row, 2);
  247.                 jTable1.setValueAt(objm.getPh(), row, 3);
  248.                 jTable1.setValueAt(objm.getGg(), row, 4);
  249.                 jTable1.setValueAt(objm.getCd(), row, 5);
  250.                 jTable1.setValueAt(objm.getDw(), row, 6);
  251.                 jTable1.setValueAt(objm.getJhjg(), row, 7);
  252.                 jTable1.setValueAt(objm.getLsjg(), row, 10);
  253.                 jTable1.setValueAt(objm.getYxq(), row, 11);
  254.             }
  255.             /*jTable1.getColumnModel().getColumn(8).setPreferredWidth(12);
  256.             jTable1.requestFocus();*/
  257.    }
  258.    public void jCbox_itemStateChanged(ItemEvent e){
  259.        if (jComboBox1.getItemCount() > 0) {
  260.                 int selectindex;
  261.                 selectindex = jComboBox1.getSelectedIndex();
  262.                 System.out.println(jComboBox1.getSelectedIndex());
  263.                 if (jComboBox21.getItemCount() > 0 ){
  264.                     jComboBox21.setSelectedIndex(selectindex);
  265.                 }
  266.                 System.out.println(jComboBox21.getItemCount());
  267.                 //System.out.println(jComboBox21.getSelectedItem());
  268.             }
  269.    }
  270.     public void jButton3_actionPerformed(ActionEvent e) {
  271.         javax.swing.DefaultDesktopManager manger = new DefaultDesktopManager();
  272.         int result = JOptionPane.showOptionDialog(null,"是否真的退出药品入库信息情况?","系统提示",
  273.                                    JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,
  274.                                    null,new String[]  {"是","否"},"否");
  275.         if (result == JOptionPane.YES_OPTION) {
  276.             try{
  277.                // UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
  278.                // SwingUtilities.updateComponentTreeUI(this);
  279.             }catch(Exception ex){
  280.                 ex.printStackTrace();
  281.             }
  282.            manger.closeFrame(this);
  283.         }
  284.     }
  285.     public void jBsave_actionPerformed(ActionEvent e) {
  286.         javax.swing.DefaultDesktopManager manger = new DefaultDesktopManager();
  287.         int result = JOptionPane.showOptionDialog(null,"是否真的存盘药品入库信息情况?","系统提示",
  288.                                    JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,
  289.                                    null,new String[]  {"是","否"},"否");
  290.         if (result == JOptionPane.NO_OPTION) return;
  291.         if (jTjbr.getText().trim().length() <= 0){
  292.             JOptionPane.showMessageDialog(null,"经办人不允许为空,请录入!!!","系统提示",JOptionPane.ERROR_MESSAGE);
  293.             jTjbr.requestFocus();
  294.             return;
  295.         }
  296.         if(jTable1.getRowCount() > 1){
  297.             for (int i = 0 ; i < jTable1.getRowCount(); i++) {
  298.                 String ypbh, ypbh1;
  299.                 ypbh = String.valueOf(jTable1.getValueAt(i, 1));
  300.                 System.out.println("ypbh = " + ypbh + "; i = " + i);
  301.                 int j = i + 1;
  302.                 if (j == jTable1.getRowCount()) continue;
  303.                 for (; j < jTable1.getRowCount(); j++) {
  304.                     ypbh1 = String.valueOf(jTable1.getValueAt(j, 1));
  305.                     System.out.println("ypbh1 = " + ypbh1 + "; j = " + j);
  306.                     if(ypbh.equals(ypbh1)){
  307.                         JOptionPane.showMessageDialog(null, "编号【" + ypbh1 + "】重复请从新选择", "系统提示",
  308.                                               JOptionPane.ERROR_MESSAGE);
  309.                         return;
  310.                     }
  311.                 }
  312.             }
  313.         }
  314. //        String findStr = "from Obj_SellDetaile s where  s.ypbh = '" + ypbh + "'";
  315.         /*------生成主表更新对象 Obj_BuyMain--------*/
  316.         Obj_BuyMain objmain = new Obj_BuyMain();
  317.         objmain.setGysbh(String.valueOf(jComboBox21.getSelectedItem()));
  318.         int pzs,rksl;
  319.         float rkje,xszk,ysje,ssje,wsje;
  320.         try{
  321.             pzs = Integer.parseInt(jTxszl.getText().trim());
  322.             rksl = Integer.parseInt(jTxssl.getText().trim());
  323.             rkje = Float.parseFloat(jThjje.getText().trim());
  324.         }catch(java.lang.NumberFormatException format){
  325.            JOptionPane.showMessageDialog(null, "输入的数据格式有误,请重新录入!!n" + format.getMessage(), "系统提示",JOptionPane.ERROR_MESSAGE);
  326.            System.out.println(format.getMessage());
  327.            return;
  328.        }
  329.         objmain.setPzs(pzs);
  330.         objmain.setRksl(rksl);
  331.         objmain.setRkje(rkje);
  332.         java.sql.Date rq = null;
  333.         try{
  334.             rq = java.sql.Date.valueOf(jTldrq.getText().trim());
  335.         }catch(Exception ex){
  336.             ex.printStackTrace();
  337.             return;
  338.         }
  339.         objmain.setRkrq(rq);
  340.         objmain.setJbr(jTjbr.getText().trim());
  341.         objmain.setSts("F");
  342.         objmain.setRkdjh(jTxsph.getText().trim());
  343.         if (AdapterDao.InsertBuyMain(objmain)){
  344.             JOptionPane.showMessageDialog(null,"药品入库情况数据录入成功","系统提示",JOptionPane.INFORMATION_MESSAGE);
  345.            }else{
  346.                JOptionPane.showMessageDialog(null,"销售情况数据存盘失败","系统提示",JOptionPane.ERROR_MESSAGE);
  347.            }
  348.         /*------生成从表更新对象 Obj_BuyDetaile--------*/
  349.         for (int i = 0 ; i < jTable1.getRowCount(); i++){
  350.             Obj_BuyDetaile objbuydetaile = new Obj_BuyDetaile();
  351.             String lsh,ypbh,xsdjh;
  352.             int drksl;
  353.             float rkdj,je;
  354.             lsh = String.valueOf(jTable1.getValueAt(i,0));
  355.             ypbh = String.valueOf(jTable1.getValueAt(i,1));
  356.             xsdjh = jTxsph.getText().trim();
  357.             drksl = Integer.parseInt(String.valueOf(jTable1.getValueAt(i,8)));
  358.             rkdj = Float.parseFloat(String.valueOf(jTable1.getValueAt(i,7)));
  359.             je = Float.parseFloat(String.valueOf(jTable1.getValueAt(i,9)));
  360.             objbuydetaile.setRklsh(lsh);
  361.             objbuydetaile.setYpbh(ypbh);
  362.             objbuydetaile.setRkdjh(xsdjh);
  363.             objbuydetaile.setRksl(drksl);
  364.             objbuydetaile.setRkdj(rkdj);
  365.             objbuydetaile.setRkje(je);
  366.             objbuydetaile.setRkrq(rq);
  367.             objbuydetaile.setKcsl(drksl);
  368.             AdapterDao.InsertBuyDetaile(objbuydetaile);
  369.             //更新盘点数据表Obj_Stock 以便进行查询
  370.             String stockQuery = "from Obj_Stock where ypbh = '" + ypbh + "'";
  371.             java.util.List list = AdapterDao.QueryObject(stockQuery);
  372.             java.util.Iterator iterator = list.iterator();
  373.             appjxc.model.Obj_Stock objstock = (appjxc.model.Obj_Stock)iterator.next();
  374.             //objstock.setYpbh(ypbh);
  375.             objstock.setRksl(drksl + objstock.getRksl());
  376.             objstock.setKcsl(rksl + objstock.getKcsl());
  377.             AdapterDao.InsertStock(objstock);
  378.         }
  379.         this.jThjje.setText("");
  380.         this.jTjbr.setText("");
  381.         this.jTldrq.setText("");
  382.         this.jTxsph.setText("");
  383.         this.jTxssl.setText("");
  384.         this.jTxszl.setText("");
  385.         jBreg.setEnabled(true);
  386.         jBadd.setEnabled(false);
  387.         jBdel.setEnabled(false);
  388.         jBsave.setEnabled(false);
  389.         jComboBox1.removeAllItems();
  390.         jComboBox21.removeAllItems();
  391.         String[] tname = {"流水号","药品编号","药品名称","药品批号","规格","产地","单位","进货价格","进货数量","进货金额","零售价","有效期至"};
  392.         java.util.Vector vname = new java.util.Vector();
  393.         for (int i = 0 ; i < tname.length ; i++){
  394.             vname.addElement(tname[i]);
  395.         }
  396.         tableModel = new DefaultTableModel(vname,0);
  397.         tableModel.addTableModelListener(this);
  398.         jTable1.setModel(tableModel);
  399.       }
  400.     public void jBreg_actionPerformed(ActionEvent e) {
  401.         /*-----对销售主表操作------*/
  402.         String cgph;
  403.         cgph = new appjxc.constrol.GenalLsh().getPh();
  404.         jTxsph.setText(cgph);
  405.         jTxsph.setEnabled(false);
  406.         java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-mm-dd");
  407.         Locale loc = new Locale("CN");
  408.         String lsh = null;
  409.         calendar = Calendar.getInstance(loc);
  410.        // calendar.add(calendar.get(Calendar.DAY_OF_MONTH) , 20);
  411.         calendar.setTimeInMillis(System.currentTimeMillis());
  412.         int year = calendar.get(Calendar.YEAR);
  413.         int month = calendar.get(Calendar.MONTH) + 1;
  414.         int day = calendar.get(Calendar.DAY_OF_MONTH);
  415.         //System.out.println("" + year + "" + month +  "" + day);
  416.         jTldrq.setText(year + "-" + month + "-" + day );
  417.         jTldrq.setEnabled(false);
  418.         jComboBox1.requestFocus();
  419.         //此处简洁处理为一次读入完成之后,在进行登记添加的时候不进行读取以提高效率
  420.         if (jComboBox1.getItemCount() <= 0 ){
  421.             String queryClient = "";
  422.             queryClient = "from Obj_gys";
  423.             List listClient = AdapterDao.QueryObject(queryClient);
  424.             Iterator iteratorclient = listClient.iterator();
  425.             jComboBox1.removeAllItems();
  426.             jComboBox21.removeAllItems();
  427.             while(iteratorclient.hasNext()){
  428.                 Obj_gys object = (Obj_gys)iteratorclient.next();
  429.                 jComboBox1.addItem(object.getGysmc());
  430.                 jComboBox21.addItem(object.getGysbh());
  431.             }
  432.             jComboBox1.addItemListener(new JF_view_buy_jCbox_itemAdapter(this));
  433.         }
  434.         jTjbr.requestFocus();
  435.         jBreg.setEnabled(false);
  436.         jBadd.setEnabled(true);
  437.     }
  438.     public void jBdel_actionPerformed(ActionEvent e) {
  439.         int row = jTable1.getSelectedRow();
  440.         if (row < 0) return;
  441.         Object ypbh = jTable1.getValueAt(row,1);
  442.         int result = JOptionPane.showOptionDialog(null,"是否真的删除编号为【" + ypbh +  "】的销售明细信息情况?","系统提示",
  443.                                    JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,
  444.                                    null,new String[]  {"是","否"},"否");
  445.         if (result == JOptionPane.NO_OPTION) return;
  446.         tableModel.removeRow(row);
  447.     }
  448. }
  449. class JF_view_buy_jBdel_actionAdapter implements ActionListener {
  450.     private JF_view_buy adaptee;
  451.     JF_view_buy_jBdel_actionAdapter(JF_view_buy adaptee) {
  452.         this.adaptee = adaptee;
  453.     }
  454.     public void actionPerformed(ActionEvent e) {
  455.         adaptee.jBdel_actionPerformed(e);
  456.     }
  457. }
  458. class JF_view_buy_jBreg_actionAdapter implements ActionListener {
  459.     private JF_view_buy adaptee;
  460.     JF_view_buy_jBreg_actionAdapter(JF_view_buy adaptee) {
  461.         this.adaptee = adaptee;
  462.     }
  463.     public void actionPerformed(ActionEvent e) {
  464.         adaptee.jBreg_actionPerformed(e);
  465.     }
  466. }
  467. class JF_view_buy_jBsave_actionAdapter implements ActionListener {
  468.     private JF_view_buy adaptee;
  469.     JF_view_buy_jBsave_actionAdapter(JF_view_buy adaptee) {
  470.         this.adaptee = adaptee;
  471.     }
  472.     public void actionPerformed(ActionEvent e) {
  473.         adaptee.jBsave_actionPerformed(e);
  474.     }
  475. }
  476. class JF_view_buy_jButton3_actionAdapter implements ActionListener {
  477.     private JF_view_buy adaptee;
  478.     JF_view_buy_jButton3_actionAdapter(JF_view_buy adaptee) {
  479.         this.adaptee = adaptee;
  480.     }
  481.     public void actionPerformed(ActionEvent e) {
  482.         adaptee.jButton3_actionPerformed(e);
  483.     }
  484. }
  485. class JF_view_buy_jCbox_itemAdapter implements ItemListener {
  486.     private JF_view_buy adaptee;
  487.     JF_view_buy_jCbox_itemAdapter(JF_view_buy adaptee) {
  488.         this.adaptee = adaptee;
  489.     }
  490.     public void itemStateChanged(ItemEvent itemEvent) {
  491.         adaptee.jCbox_itemStateChanged(itemEvent);
  492.     }
  493. }
  494. class JF_view_buy_jcbh_itemAdapter implements ItemListener {
  495.     private JF_view_buy adaptee;
  496.     JF_view_buy_jcbh_itemAdapter(JF_view_buy adaptee) {
  497.         this.adaptee = adaptee;
  498.     }
  499.     public void itemStateChanged(ItemEvent itemEvent) {
  500.         adaptee.jcbh_itemStateChanged(itemEvent);
  501.     }
  502. }
  503. class JF_view_buy_jBadd_actionAdapter implements ActionListener {
  504.     private JF_view_buy adaptee;
  505.     JF_view_buy_jBadd_actionAdapter(JF_view_buy adaptee) {
  506.         this.adaptee = adaptee;
  507.     }
  508.     public void actionPerformed(ActionEvent e) {
  509.         adaptee.jBadd_actionPerformed(e);
  510.     }
  511. }