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

📄 findshow.java

📁 利用java swing实现简单的单机版仓库管理
💻 JAVA
字号:
package control.view.prodout;import java.awt.*;import javax.swing.*;import java.awt.event.*;import beans.ProdOut;public class FindShow extends JDialog implements ActionListener{    private static String msg="";        private JButton jb_find=new JButton("查找");    private JButton jb_exit=new JButton("取消");    private JLabel la_pINum=new JLabel("总数量:");    private JLabel la_pITotalMoney=new JLabel("总金额:");    private JLabel la_pIByer=new JLabel("经办人:");    private JLabel la_pIStorager=new JLabel("库管员:");    private JLabel la_pITime=new JLabel("出库日期:");    private JTextField tf_pINum=new JTextField();    private JTextField tf_pITotalMoney=new JTextField();    private JTextField tf_pIByer=new JTextField();    private JTextField tf_pIStorager=new JTextField();    private JTextField tf_pITime=new JTextField();        public static ProdOut pro;    public void actionPerformed(ActionEvent e){                if(e.getSource() instanceof JButton){            JButton b=(JButton)e.getSource();                        if(b == jb_find){                try{                    if(getProdOut() == null){                        throw new Exception(msg);                    }else{                        this.pro=this.getProdOut();                        this.dispose();                        ((JFrame)this.getParent()).dispose();                        new FindProdOut("查询出库单结果");                    }                }catch(Exception ep){                    System.out.println(ep.getMessage());                    JOptionPane.showMessageDialog(this, msg);                }            }else if(b == jb_exit){                if( (JOptionPane.showConfirmDialog(this, new String("是否真的退出?")))==                        JOptionPane.YES_OPTION) {                    this.dispose();                }            }        }    }        public FindShow(JFrame fra,String title,boolean model){        super(fra,title,model);        setMid(500, 400, this);        this.setResizable(false);        addComponent();        this.show(true);    }    public void addComponent(){        this.setLayout(null);                la_pINum.setBounds(100,20,110,30);        la_pITotalMoney.setBounds(100,70,110,30);        la_pIByer.setBounds(100,120,110,30);        la_pIStorager.setBounds(100,170,110,30);        la_pITime.setBounds(80,220,150,30);                tf_pINum.setBounds(210,20,150,30);        tf_pITotalMoney.setBounds(210,70,150,30);        tf_pIByer.setBounds(210,120,150,30);        tf_pIStorager.setBounds(210,170,100,30);        tf_pITime.setBounds(210,220,100,30);                jb_find.setBounds(100,270,100,35);        jb_exit.setBounds(220,270,100,35);                this.add(la_pINum);        this.add(tf_pINum);        this.add(la_pITotalMoney);        this.add(tf_pITotalMoney);        this.add(la_pIByer);                this.add(tf_pIByer);         this.add(la_pIStorager);        this.add(tf_pIStorager);        this.add(la_pITime);        this.add(tf_pITime);                jb_find.addActionListener(this);        jb_exit.addActionListener(this);        this.add(jb_find);        this.add(jb_exit);    }        private ProdOut getProdOut() throws Exception{        int pINum=0;        double pITotalMoney=0.0;        String pIByer="",pIStorager="";        String pITime="";        if(!tf_pINum.getText().equals("")){            try{                pINum=Integer.parseInt(tf_pINum.getText());            }catch(Exception e){                msg="请确认输入的数量和金额是数值";                return null;            }        }else{            pINum=0;        }        if(!tf_pITotalMoney.getText().equals("")){            try{                pITotalMoney=Double.parseDouble(tf_pITotalMoney.getText());            }catch(Exception e){                msg="请确认输入的数量和金额是数值";                return null;            }        }else{            pITotalMoney=0;        }        if(!tf_pIByer.getText().equals("")){            pIByer=tf_pIByer.getText();        }else{            pIByer="";        }        if(!tf_pIStorager.getText().equals("")){            pIStorager=tf_pIStorager.getText();        }else{            pIStorager="";        }        if(!tf_pITime.getText().equals("")){            try{                pITime=tf_pITime.getText();            }catch(Exception e){                System.out.println(e.getMessage());                return null;            }        }else{            pITime="";        }        return new ProdOut(            "",            pINum,            pITotalMoney,            pIByer,            pIStorager,            pITime,            ""          );    }        public void setMid(int width,int height,java.awt.Window fra){        Dimension ds=Toolkit.getDefaultToolkit().getScreenSize();        int x=new Double( (ds.getWidth()-width)/2 ).intValue();        int y=new Double( (ds.getHeight()-height)/2 ).intValue();        fra.setBounds(x,y,width,height);    }}

⌨️ 快捷键说明

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