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

📄 jiafeibody.java

📁 基于UML的小区物业管理系统设计:1.对小区所有房屋资料的录入和增
💻 JAVA
字号:
package 小区物业管理系统;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.sql.*;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JComboBox;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class jiafeibody extends JFrame {
    JPanel contentPane;
    JLabel 房号 = new JLabel();
    JComboBox fanghao = new JComboBox();
    JLabel jLabel2 = new JLabel();
    JComboBox nian = new JComboBox();
    JComboBox yue = new JComboBox();
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel5 = new JLabel();
    JLabel jLabel6 = new JLabel();
    JLabel jLabel7 = new JLabel();
    JTextField yezhu = new JTextField();
    JTextField qianshui = new JTextField();
    JTextField qiandian = new JTextField();
    JTextField qianwu = new JTextField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    public jiafeibody() {
        try {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    /**
     * Component initialization.
     *
     * @throws java.lang.Exception
     */
    private void jbInit() throws Exception {
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(null);
        setSize(new Dimension(496, 620));
        setTitle("录入欠费记录");
        房号.setText("房号");
        房号.setBounds(new Rectangle(25, 60, 84, 28));
        fanghao.setBounds(new Rectangle(101, 65, 133, 23));
        fanghao.addActionListener(new jiafeibody_fanghao_actionAdapter(this));
        jLabel2.setText("时间");
        jLabel2.setBounds(new Rectangle(25, 151, 42, 15));
        nian.setBounds(new Rectangle(102, 144, 86, 23));
        yue.setBounds(new Rectangle(220, 144, 94, 23));
        yue.addActionListener(new jiafeibody_yue_actionAdapter(this));
        jLabel3.setText("年");
        jLabel3.setBounds(new Rectangle(200, 148, 42, 15));
        jLabel4.setText("月");
        jLabel4.setBounds(new Rectangle(334, 149, 42, 15));
        jLabel1.setText("业主");
        jLabel1.setBounds(new Rectangle(25, 244, 42, 15));
        jLabel5.setText("欠水费");
        jLabel5.setBounds(new Rectangle(25, 309, 42, 15));
        jLabel6.setText("欠电费");
        jLabel6.setBounds(new Rectangle(25, 373, 42, 15));
        jLabel7.setText("欠物业费");
        jLabel7.setBounds(new Rectangle(25, 439, 66, 15));
        yezhu.setEditable(false);
        yezhu.setBounds(new Rectangle(104, 238, 82, 20));
        qianshui.setBounds(new Rectangle(103, 308, 125, 20));
        qiandian.setBounds(new Rectangle(103, 372, 123, 20));
        qianwu.setBounds(new Rectangle(104, 437, 120, 20));
        jButton1.setBounds(new Rectangle(64, 529, 81, 23));
        jButton1.setText("提交");
        jButton1.addActionListener(new jiafeibody_jButton1_actionAdapter(this));
        jButton2.setBounds(new Rectangle(312, 529, 81, 23));
        jButton2.setText("返回");
        jButton2.addActionListener(new jiafeibody_jButton2_actionAdapter(this));
        contentPane.add(房号);
        contentPane.add(jLabel2);
        contentPane.add(yue);
        contentPane.add(nian);
        contentPane.add(fanghao);
        contentPane.add(jLabel3);
        contentPane.add(jLabel4);
        contentPane.add(jLabel1);
        contentPane.add(jLabel7);
        contentPane.add(jLabel5);
        contentPane.add(jLabel6);
        contentPane.add(yezhu);
        contentPane.add(qianshui);
        contentPane.add(qiandian);
        contentPane.add(qianwu);
        contentPane.add(jButton2);
        contentPane.add(jButton1);

        {
            DBConnection lianjie = new DBConnection();
            Statement stat=lianjie.stat;
            try{
                ResultSet rst=stat.executeQuery("select * from ZHUHU");
                      while(rst.next())
                          fanghao.addItem(rst.getString("房号"));

                      rst.close();
                      stat.close();
                      lianjie.close();
            }catch(Exception ee){}
        }
        nian.addItem("2005");
        nian.addItem("2006");
        nian.addItem("2007");
        nian.addItem("2008");

        yue.addItem("1");
        yue.addItem("2");
        yue.addItem("3");
        yue.addItem("4");
        yue.addItem("5");
        yue.addItem("6");
        yue.addItem("7");
        yue.addItem("8");
        yue.addItem("9");
        yue.addItem("10");
        yue.addItem("11");
        yue.addItem("12");

    }

    public void yue_actionPerformed(ActionEvent e) {

    }

    public void jButton1_actionPerformed(ActionEvent e) {
   if(qianshui.getText().equals(""))
       qianshui.setText("0");
   if(qiandian.getText().equals(""))
       qiandian.setText("0");
   if(qianwu.getText().equals(""))
       qianwu.setText("0");

   DBConnection lianjie = new DBConnection();
                Statement stat=lianjie.stat;
                try{
               stat.execute("insert into QIANFEI values ('"+
                       fanghao.getSelectedItem()+"','"+
                  yezhu.getText()+"','"+
                 nian.getSelectedItem()+"','"+
                 yue.getSelectedItem()+"','"+
                 qianshui.getText()+"','"+
                 qiandian.getText()+"','"+
                 qianwu.getText()+"')"
             );
               JOptionPane.showMessageDialog(this,"添加记录成功");
               stat.close();
               lianjie.close();
                }catch(Exception ee){

        }


    }

    public void fanghao_actionPerformed(ActionEvent e) {
        DBConnection lianjie = new DBConnection();
                        Statement stat=lianjie.stat;
                        try{
                            ResultSet rst=stat.executeQuery("select * from ZHUHU where 房号='"+
                                          fanghao.getSelectedItem()+"'");
                            while(rst.next())
                       yezhu.setText(rst.getString("业主"));


                            rst.close();
                            stat.close();
                            lianjie.close();
                        }catch(Exception ee){

        }
    }

    public void jButton2_actionPerformed(ActionEvent e) {
this.dispose();
        new feiguan();
    }
}


class jiafeibody_jButton2_actionAdapter implements ActionListener {
    private jiafeibody adaptee;
    jiafeibody_jButton2_actionAdapter(jiafeibody adaptee) {
        this.adaptee = adaptee;
    }

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


class jiafeibody_fanghao_actionAdapter implements ActionListener {
    private jiafeibody adaptee;
    jiafeibody_fanghao_actionAdapter(jiafeibody adaptee) {
        this.adaptee = adaptee;
    }

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


class jiafeibody_jButton1_actionAdapter implements ActionListener {
    private jiafeibody adaptee;
    jiafeibody_jButton1_actionAdapter(jiafeibody adaptee) {
        this.adaptee = adaptee;
    }

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


class jiafeibody_yue_actionAdapter implements ActionListener {
    private jiafeibody adaptee;
    jiafeibody_yue_actionAdapter(jiafeibody adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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