s1(java)项目实战(固定资产管理)(quary

    技术2022-05-11  83

    package quary;

    import java.awt.*;

    import javax.swing.*;import tools.*;import java.util.*;import java.awt.*;import java.awt.event.*;

    public class AssetFullDialog extends JDialog {    private String assetid;    JLabel JBL_card = new JLabel();    private DBConnection dcon = null;    private HashMap perMap = new HashMap();    JLabel jLabel1 = new JLabel();    JTextField txtid = new JTextField();    JLabel jLabel2 = new JLabel();    JTextField txtname = new JTextField();    JLabel jLabel3 = new JLabel();    JLabel jLabel4 = new JLabel();    JTextField txttype = new JTextField();    JTextField txtprice = new JTextField();    JLabel jLabel5 = new JLabel();    JTextField txtbuytime = new JTextField();    JTextField txtstatus = new JTextField();    JLabel jLabel6 = new JLabel();    JTextField txtkinds = new JTextField();    JTextArea taremem = new JTextArea(3, 15);    JLabel jLabel8 = new JLabel();    JButton btn_no = new JButton();

        public AssetFullDialog(Frame owner, String title, boolean modal,                           String id) {        super(owner, title, modal);        try {

                this.assetid = id;            setDefaultCloseOperation(DISPOSE_ON_CLOSE);            jbInit();            pack();        } catch (Exception exception) {            exception.printStackTrace();        }    }

        public AssetFullDialog(String id) {        this(new Frame(), "AssetReturn", false, id);    }

        private void jbInit() throws Exception {        this.getContentPane().setLayout(null);        JBL_card.setFont(new java.awt.Font("宋体", Font.BOLD, 24));        JBL_card.setForeground(new Color(0, 138, 0));        JBL_card.setText("设备卡");        JBL_card.setBounds(new Rectangle(119, 0, 86, 47));        jLabel1.setText("单    价");        jLabel1.setBounds(new Rectangle(149, 73, 71, 27));        txtid.setBounds(new Rectangle(62, 43, 81, 28));        jLabel2.setText("设备型号");        jLabel2.setBounds(new Rectangle(6, 74, 71, 27));        txtname.setBounds(new Rectangle(207, 43, 81, 28));        jLabel3.setText("设备编号");        jLabel3.setBounds(new Rectangle(7, 41, 71, 27));        jLabel4.setText("设备名称");        jLabel4.setBounds(new Rectangle(149, 44, 71, 27));        txttype.setBounds(new Rectangle(62, 74, 81, 28));        txtprice.setBounds(new Rectangle(207, 75, 81, 28));        jLabel5.setText("购置时间");        jLabel5.setBounds(new Rectangle(6, 102, 71, 27));        txtbuytime.setBounds(new Rectangle(62, 104, 81, 28));        txtstatus.setBounds(new Rectangle(207, 108, 81, 28));        jLabel6.setText("状    态");        jLabel6.setBounds(new Rectangle(149, 105, 71, 27));        txtkinds.setBounds(new Rectangle(62, 134, 81, 28));        taremem.setBounds(new Rectangle(17, 168, 286, 48));        jLabel8.setText("所属科目");        jLabel8.setBounds(new Rectangle(8, 134, 71, 27));        btn_no.setBounds(new Rectangle(123, 240, 66, 29));        dcon = new DBConnection();        String sql = "select asset_id,asset_name,asset_type,asset_price,asset_buytime,asset_status,remark,childkind_id from asset where asset_id = '" +                     assetid + "'";        Vector v = dcon.select(sql);        txtid.setText(((Vector) v.get(0)).get(0).toString());        txtname.setText(((Vector) v.get(0)).get(1).toString());        txttype.setText(((Vector) v.get(0)).get(2).toString());        txtprice.setText(((Vector) v.get(0)).get(3).toString());        txtbuytime.setText(((Vector) v.get(0)).get(4).toString());        txtstatus.setText(((Vector) v.get(0)).get(5).toString());        taremem.setText(((Vector) v.get(0)).get(6).toString());        txtkinds.setEditable(false);        txtid.setEditable(false);        txtname.setEditable(false);        txttype.setEditable(false);        txtprice.setEditable(false);        txtbuytime.setEditable(false);        txtstatus.setEditable(false);        taremem.setEditable(false);

            String kindid = ((Vector) v.get(0)).get(7).toString().trim();        String sql1 = "select childkind_name from ChildKind where childkind_id= '" + kindid + "'";        Vector v1 = dcon.select(sql1);        String kindname = ((Vector) v1.get(0)).get(0).toString().trim(); ;        txtkinds.setText(kindname);        btn_no.setText("退出");        this.getContentPane().add(jLabel3);        this.getContentPane().add(jLabel4);        this.getContentPane().add(txtid);        this.getContentPane().add(txtname);        this.getContentPane().add(jLabel1);        this.getContentPane().add(jLabel2);        this.getContentPane().add(txttype);        this.getContentPane().add(txtprice);        this.getContentPane().add(txtstatus);        this.getContentPane().add(txtbuytime);        this.getContentPane().add(txtkinds);        this.getContentPane().add(jLabel8);        this.getContentPane().add(jLabel5);        this.getContentPane().add(jLabel6);        this.getContentPane().add(taremem);        this.getContentPane().add(btn_no);        this.getContentPane().add(JBL_card);        this.setResizable(false);

            btn_no.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                closedialog();            }        });    }

        //close    private void closedialog() {        this.dispose();    }


    最新回复(0)