⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zichanframe.java

📁 一个资产管理系统的源码
💻 JAVA
字号:
package zichan;

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

import javax.swing.*;
import java.awt.Color;
import java.awt.SystemColor;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Segment;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class ZichanFrame extends JFrame implements ActionListener{
    //Color col=new Color(10);
    Deng de;
    public Zhong zh;
    public Xi xi;
    JPanel contentPane;
    BorderLayout borderLayout1 = new BorderLayout();
    JMenuBar jMenuBar1 = new JMenuBar();
    JMenu jMenuFile = new JMenu();
    JMenuItem jMenuFileExit = new JMenuItem();
    JMenuItem jMenuItem1 = new JMenuItem();
    JMenuItem jMenuItem2 = new JMenuItem();
    JMenuItem jMenuItem3 = new JMenuItem();
    JMenu jMenu1 = new JMenu();
    JMenuItem jMenuItem4 = new JMenuItem();
    JMenuItem jMenuItem5 = new JMenuItem();
    JMenuItem jMenuItem6 = new JMenuItem();
    JMenuItem jMenuItem7 = new JMenuItem();
    JMenu jMenu2 = new JMenu();
    JMenuItem jMenuItem8 = new JMenuItem();
    JMenuItem jMenuItem9 = new JMenuItem();
    JMenuItem jMenuItem10 = new JMenuItem();
    JMenuItem jMenuItem11 = new JMenuItem();
    JMenu jMenu3 = new JMenu();
    JMenuItem jMenuItem12 = new JMenuItem();
    JMenuItem jMenuItem13 = new JMenuItem();
    JMenu jMenu4 = new JMenu();
    JMenuItem jMenuItem14 = new JMenuItem();
    JMenuItem jMenuItem15 = new JMenuItem();
    MenuHandler mh;
    public ZichanFrame() {

          mh=new MenuHandler(new AssetHandler(),new CateHandler(),new EmpHandler(),new LendHandler(),new OperatorHandler());

        try {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    /**
     * Component initialization.
     *
     * @throws java.lang.Exception
     */
    private void jbInit() throws Exception {
        TCardModle tcm;
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(borderLayout1);
        setSize(new Dimension(800,600));
         //Color nong=col.brighter();
        //setBackground(nong);
        setTitle("资产管理系统");
        jMenuFile.setBackground(SystemColor.controlLtHighlight);

        jMenuFile.setText("固定资产管理");
        jMenuFileExit.setBackground(SystemColor.controlLtHighlight);
        jMenuFileExit.setText("增加");
        jMenuFileExit.setActionCommand("aFa");
        jMenuFileExit.addActionListener(mh);
        jMenuFileExit.addActionListener(new
                                        ZichanFrame_jMenuFileExit_ActionAdapter(this));
        jMenuItem1.setBackground(SystemColor.controlLtHighlight);
        jMenuItem1.setText(" 删除");
        jMenuItem1.setActionCommand("dFa");
        jMenuItem1.addActionListener(mh);
        jMenuItem1.addActionListener(new ZichanFrame_jMenuItem1_actionAdapter(this));
        jMenuItem2.setBackground(SystemColor.controlLtHighlight);
        jMenuItem2.setText(" 修改");
        jMenuItem2.setActionCommand("uFa");
        jMenuItem2.addActionListener(mh);
        jMenuItem2.addActionListener(new ZichanFrame_jMenuItem2_actionAdapter(this));
        jMenuItem3.setBackground(SystemColor.controlLtHighlight);
        jMenuItem3.setText(" 查询");
        jMenuItem3.addActionListener(new ZichanFrame_jMenuItem3_actionAdapter(this));
        jMenu1.setBackground(SystemColor.controlLtHighlight);
        jMenu1.setText("职工管理");
        jMenuItem4.setBackground(SystemColor.controlLtHighlight);
        jMenuItem4.setText(" 增加");
        jMenuItem4.setActionCommand("aEp");
        jMenuItem4.addActionListener(mh);
        jMenuItem5.setBackground(SystemColor.controlLtHighlight);
        jMenuItem5.setText(" 删除");
        jMenuItem5.setActionCommand("dEp");
        jMenuItem5.addActionListener(mh);
        jMenuItem6.setBackground(SystemColor.controlLtHighlight);
        jMenuItem6.setText(" 修改");
        jMenuItem6.setActionCommand("uEp");
        jMenuItem6.addActionListener(mh);
        jMenuItem7.setBackground(SystemColor.controlLtHighlight);
        jMenuItem7.setText(" 查询");
        jMenu2.setBackground(SystemColor.controlLtHighlight);
        jMenu2.setText("资产类别管理");
        jMenuItem8.setBackground(SystemColor.controlLtHighlight);
        jMenuItem8.setText(" 增加");
        jMenuItem8.setActionCommand("aCt");
        jMenuItem8.addActionListener(mh);
        jMenuItem9.setBackground(SystemColor.controlLtHighlight);
        jMenuItem9.setText(" 删除");
        jMenuItem9.setActionCommand("dCt");
        jMenuItem9.addActionListener(mh);
        jMenuItem10.setBackground(SystemColor.controlLtHighlight);
        jMenuItem10.setText(" 修改");
        jMenuItem10.setActionCommand("uCt");
        jMenuItem10.addActionListener(mh);
        jMenuItem11.setBackground(SystemColor.controlLtHighlight);
        jMenuItem11.setText(" 查询");
        jMenu3.setBackground(SystemColor.controlLtHighlight);
        jMenu3.setText("借用和归还管理");
        jMenuItem12.setBackground(SystemColor.controlLtHighlight);
        jMenuItem12.setText(" 借用");
         System.out.println(111111111);
        jMenuItem12.setActionCommand("lFA");
        jMenuItem12.addActionListener(mh);
        jMenuItem13.setBackground(SystemColor.controlLtHighlight);
        jMenuItem13.setText(" 归还");
        jMenuItem13.setActionCommand("rFA");
        jMenuItem13.addActionListener(mh);
        jMenu4.setBackground(SystemColor.controlLtHighlight);
        jMenu4.setText("用户管理");
        jMenuItem14.setBackground(SystemColor.controlLtHighlight);
        jMenuItem14.setText(" 密码修改");
        jMenuItem14.setActionCommand("uPw");
        jMenuItem14.addActionListener(mh);

        jMenuItem15.setBackground(SystemColor.controlLtHighlight);
        jMenuItem15.setText(" 退出");
        jMenuItem15.addActionListener(new ZichanFrame_jMenuItem15_actionAdapter(this));
        contentPane.setBackground(SystemColor.controlLtHighlight);

        zh=new Zhong();
        xi=new Xi(zh.tcm);
        contentPane.add(zh,BorderLayout.CENTER);
        contentPane.add(xi,BorderLayout.WEST);

        jMenuBar1.add(jMenuFile);
        jMenuBar1.add(jMenu1);
        jMenuBar1.add(jMenu2);
        jMenuBar1.add(jMenu3);
        jMenuBar1.add(jMenu4);
        jMenuFile.add(jMenuFileExit);
        jMenuFile.add(jMenuItem1);
        jMenuFile.add(jMenuItem2);
        jMenuFile.add(jMenuItem3);
        jMenu1.add(jMenuItem4);
        jMenu1.add(jMenuItem5);
        jMenu1.add(jMenuItem6);
        jMenu1.add(jMenuItem7);
        jMenu2.add(jMenuItem8);
        jMenu2.add(jMenuItem9);
        jMenu2.add(jMenuItem10);
        jMenu2.add(jMenuItem11);
        jMenu3.add(jMenuItem12);
        jMenu3.add(jMenuItem13);
        jMenu4.add(jMenuItem14);
        jMenu4.add(jMenuItem15);
        setJMenuBar(jMenuBar1);
        jMenuBar1.setBackground(Color.white);

    }
    public void login(){
       de = new Deng(this);
   }


    public void actionPerformed(ActionEvent e){
        if (e.getActionCommand() == "log") {
               OperatorModel em = new OperatorModel(de.txtUser.getText(),String.copyValueOf(de.txtpassword.getPassword()));
               if (em.verify() == 1) {
                  Share.operator = de.lblUser.getText();
                  de.dispose();
                  //buildMenu();

                  //buildFrame();
                  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                  setSize(900,600);
                  setVisible(true);
               } else {
                  JOptionPane dl=new JOptionPane();
                  dl.showMessageDialog(this,"用户名或密码","非法用户",JOptionPane.ERROR_MESSAGE);

               }
          }if(e.getActionCommand()=="exit"){

              de.dispose();
          }

    }





    /**
     * File | Exit action performed.
     *
     * @param actionEvent ActionEvent
     */
/* void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
        Mydialog m=new Mydialog();
        Dialog add=new Dialog(m);
        add.setSize(400,300);
        add.setVisible(true);
    }

    public void jMenuItem15_actionPerformed(ActionEvent e) {
        this.dispose();
    }

    public void jMenuItem1_actionPerformed(ActionEvent e) {
        Mydialog n=new Mydialog();
        Dialog del=new Dialog(n);
        del.setSize(400,300);
        del.setVisible(true);


    }

    public void jMenuItem2_actionPerformed(ActionEvent e) {
        Mydialog b=new Mydialog();
        Dialog mod=new Dialog(b);
        mod.setSize(400,300);
        mod.setVisible(true);


    }

    public void jMenuItem3_actionPerformed(ActionEvent e) {
        Mydialog v=new Mydialog();
        Dialog sel=new Dialog(v);
        sel.setSize(400,300);
        sel.setVisible(true);


    }*/
    public static void main(String[] args) {
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }
        catch (Exception s) {
           System.out.println("exception: " + s.getMessage());
        }

           ZichanFrame zf= new ZichanFrame();
            zf.login();
        }

    public void jMenuItem15_actionPerformed(ActionEvent e) {
        this.dispose();
    }

}






class ZichanFrame_jMenuItem3_actionAdapter implements ActionListener {
    private ZichanFrame adaptee;
    ZichanFrame_jMenuItem3_actionAdapter(ZichanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
       // adaptee.jMenuItem3_actionPerformed(e);
    }
}


class ZichanFrame_jMenuItem2_actionAdapter implements ActionListener {
    private ZichanFrame adaptee;
    ZichanFrame_jMenuItem2_actionAdapter(ZichanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
       // adaptee.jMenuItem2_actionPerformed(e);
    }
}


class ZichanFrame_jMenuItem15_actionAdapter implements ActionListener {
    private ZichanFrame adaptee;
    ZichanFrame_jMenuItem15_actionAdapter(ZichanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jMenuItem15_actionPerformed(e);
        // adaptee.jMenuItem15_actionPerformed(e);
    }
}


class ZichanFrame_jMenuFileExit_ActionAdapter implements ActionListener {
    ZichanFrame adaptee;

    ZichanFrame_jMenuFileExit_ActionAdapter(ZichanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent actionEvent) {
       // adaptee.jMenuFileExit_actionPerformed(actionEvent);
    }
}


class ZichanFrame_jMenuItem1_actionAdapter implements ActionListener {
    private ZichanFrame adaptee;
    ZichanFrame_jMenuItem1_actionAdapter(ZichanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
       // adaptee.jMenuItem1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

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