catehandler.java

来自「一个资产管理系统的源码」· Java 代码 · 共 65 行

JAVA
65
字号
package zichan;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class CateHandler extends MyHandler implements ActionListener{
    CateModel em;
   public CateView addEv;
   public CateView uptEv;

    public CateHandler() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void actionPerformed (ActionEvent e){
        if (e.getActionCommand() == "add") {
              em = new CateModel(addEv.p1.jtfCateId.getText(),
                          addEv.p1.jtfCateName.getText(),
                          addEv.p1.jtfSubCateId.getText(),
                          addEv.p1.jtfSubCateName.getText());
              em.insert();
          }
          if (e.getActionCommand() == "upt") {
                  em.SetAll(uptEv.p1.jtfCateName.getText(),uptEv.p1.jtfSubCateName.getText());
                  em.update();
          }
          if (e.getActionCommand() == "sel") {
              if (Share.verify(uptEv.p1.jtfSubCateId)) {
                  em = new CateModel(uptEv.p1.jtfCateId.getText(),null,uptEv.p1.jtfSubCateId.getText(),null);
                  em.select();
                  uptEv.p1.jtfCateId.setText(em.getCateId());
                  uptEv.p1.jtfCateName.setText(em.getCateName());
                  uptEv.p1.jtfSubCateName.setText(em.getSubCateName());
              }
          }
          if (e.getActionCommand() == "del") {
                  em.delete();
                  uptEv.p1.jtfCateId.setText(em.getCateId());
                  uptEv.p1.jtfCateName.setText(em.getCateName());
                  uptEv.p1.jtfSubCateId.setText(em.getSubCateId());
                  uptEv.p1.jtfSubCateName.setText(em.getSubCateName());
          }
     }

    private void jbInit() throws Exception {
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?