java_ATM机银行存取款系统的设计与实现本科毕业论文

内容发布更新时间 : 2024/11/14 15:01:01星期一 下面是文章的全部内容请认真阅读。

商丘师范学院2012届本科毕业论文(设计)

package dao;

import java.sql.CallableStatement; import java.sql.Connection;

import java.sql.PreparedStatement; import java.sql.ResultSet;

import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import util.Allutil; import vo.Lsvo; public class Lsdao { public List ff() throws ClassNotFoundException, SQLException{ List list=new ArrayList(); Connection conn = Allutil.getConn(); conn.setAutoCommit(false); StringBuilder sql = new StringBuilder(\); PreparedStatement ps = conn.prepareStatement(sql.toString()); ResultSet rs = ps.executeQuery(); //SimpleDateFormat f=new SimpleDateFormat(\ while(rs.next()){ Lsvo lvo=new Lsvo(); lvo.setShijian(rs.getString(1));//rs.getDate(1) lvo.setHuming(rs.getString(2)); lvo.setCaozuo(rs.getString(3)); lvo.setYue(rs.getInt(4)); list.add(lvo); } conn.commit(); Allutil.close(conn, ps, rs); return list; } public static List ff2(Lsvo lvo,int remark) throws ClassNotFoundException, SQLException{ Connection conn = Allutil.getConn(); CallableStatement cs = conn.prepareCall(\);//预处理sql语句 conn.setAutoCommit(false); cs.setObject(1, remark); cs.setObject(2, lvo.getHuming()); cs.setObject(3, lvo.getCaozuo()); cs.setObject(4, lvo.getYue()); cs.execute(); conn.commit(); Allutil.close(conn, cs, null); return null;

21

商丘师范学院2012届本科毕业论文(设计)

} }

package dao;

import java.sql.CallableStatement; import java.sql.Connection;

import java.sql.PreparedStatement; import java.sql.ResultSet;

import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import util.Allutil; import vo.Yhvo; public class Yhdao { public List ff() throws ClassNotFoundException, SQLException{ List list=new ArrayList(); Connection conn = Allutil.getConn(); conn.setAutoCommit(false);

StringBuilder sql = new StringBuilder(\); PreparedStatement ps = conn.prepareStatement(sql.toString()); ResultSet rs = ps.executeQuery(); while(rs.next()){ Yhvo yvo=new Yhvo(); yvo.setHuming(rs.getString(1)); yvo.setMima(rs.getString(2)); yvo.setYue(rs.getInt(3)); yvo.setShijian(rs.getDate(4)); list.add(yvo); } conn.commit(); Allutil.close(conn, ps, rs); return list; } public static List ff2(Yhvo yvo,int remark) throws ClassNotFoundException, SQLException{ Connection conn = Allutil.getConn();

CallableStatement cs = conn.prepareCall(\);//预处理sql语句 conn.setAutoCommit(false); cs.setObject(1, remark); cs.setObject(2, yvo.getHuming()); cs.setObject(3, yvo.getMima()); cs.setObject(4, yvo.getYue()); cs.execute();

22

商丘师范学院2012届本科毕业论文(设计)

conn.commit(); Allutil.close(conn, cs, null); return null; }}

Action包

package action; //主界面

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel;

import javax.swing.JPasswordField; import javax.swing.JTextField;

public class Dlact extends JFrame implements ActionListener{ private static final long serialVersionUID = -5044882879474382285L; JFrame f=new JFrame(\银行存取款转账系统\); JLabel l1 = new JLabel(\户名\); JTextField t1 = new JTextField(10); JLabel l2 = new JLabel(\密码\); JPasswordField p1 = new JPasswordField(); JButton JB1 = new JButton(\登陆\); JButton JB2 = new JButton(\注册\); public void ff (){ f.add(l1); l1.setBounds(140,70,40,30); f.add(l2); l2.setBounds(140,120,40,30); f.add(t1); t1.setBounds(190,70,160,30); f.add(p1); p1.setBounds(190,120,160,30); f.add(JB1); JB1.setBounds(140,200,60,30); f.add(JB2); JB1.addActionListener(this); JB2.addActionListener(this); JB2.setBounds(280,200,60,30); f.setBounds(400,150,485,350); f.setLayout(null);

23

商丘师范学院2012届本科毕业论文(设计)

addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); f.setVisible(true); }

public static void main(String[]agrs){ Dlact d=new Dlact(); d.ff(); }

@Override

public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String s1=t1.getText(); //String s2=p1.getPassword()+\ String s2=String.valueOf(p1.getPassword()); if(e.getSource()==JB2){ Zcact z=new Zcact(); z.ff(); } else{ // f.setVisible(false); Xzact x=new Xzact(); System.out.println(s1+s2); x.ff(s1, s2);} } }

package action; //新用户注册

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.sql.SQLException; import java.util.Date;

import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel;

import javax.swing.JOptionPane; import javax.swing.JPasswordField; import javax.swing.JTextField; import dao.Lsdao;

24

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4 ceshi