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

    技术2022-05-11  74

    package set;

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

    /** * <p>Title: </p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2007</p> * * <p>Company: </p> * * @author not attributable * @version 1.0 */public class kindschoice extends JDialog {    private JComboBox jcb_kindsChoice;    private JButton btn_ok = new JButton();    private String kindstr;    public kindschoice(Frame owner, String title, boolean modal) {        super(owner, title, modal);        try {            setDefaultCloseOperation(DISPOSE_ON_CLOSE);            jbInit();            pack();        } catch (Exception exception) {            exception.printStackTrace();        }    }

        public kindschoice() {        this(new Frame(), "kindschoice", false);    }

        private void jbInit() throws Exception {        this.getContentPane().setLayout(null);        String[] kindsType = {"一级科目", "二级科目"};        jcb_kindsChoice = new JComboBox(kindsType);        jcb_kindsChoice.setBounds(new Rectangle(39, 26, 161, 39));        this.getContentPane().add(jcb_kindsChoice);        this.getContentPane().add(btn_ok);        btn_ok.setBounds(new Rectangle(75, 100, 68, 35));        btn_ok.setText("确定");        btn_ok.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                btnok();            }

            });    }

        private void btnok() {        if (jcb_kindsChoice.getSelectedItem().toString().trim().length() == 0) {            JOptionPane.showMessageDialog(this, "没有选择科目");        } else {

                kindstr = jcb_kindsChoice.getSelectedItem().toString().trim();            this.setVisible(false);        }    }

        public String getkindstr() {        return kindstr;    }

        public void closedialog() {        this.dispose();    }} 


    最新回复(0)