📄 function.java~49~
字号:
package atm;
import javax.swing.*;
import java.awt.*;
import com.borland.jbcl.layout.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Font;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Connection;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2008</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
class Function extends JFrame{
String strSql="";
String database_username="";
String database_password="";
public Function() {
super();
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
Function function = new Function();
}
private void jbInit() throws Exception {
jPanel1.setBackground(new Color(49, 106, 183));
jPanel1.setMinimumSize(new Dimension(333, 384));
jPanel1.setLayout(xYLayout1);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jButton1.setText("存款");
jButton1.addActionListener(new Function_jButton1_actionAdapter(this));
jLabel1.setBackground(UIManager.getColor("ColorChooser.foreground"));
jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
jLabel1.setForeground(Color.white);
jLabel1.setText("请选择以下功能:");
jButton2.setText("取款");
jButton2.addActionListener(new Function_jButton2_actionAdapter(this));
jButton3.setText("修改密码");
jButton3.addActionListener(new Function_jButton3_actionAdapter(this));
jButton4.setText("查看历史记录");
jButton4.addActionListener(new Function_jButton4_actionAdapter(this));
jButton5.setText("退出");
jButton5.addActionListener(new Function_jButton5_actionAdapter(this));
jButton6.setText("查询结余");
this.getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
jPanel1.add(jLabel1, new XYConstraints(11, 44, -1, -1));
jPanel1.add(jButton4, new XYConstraints(257, 234, -1, -1));
jPanel1.add(jButton2, new XYConstraints(15, 232, 119, -1));
jPanel1.add(jButton6, new XYConstraints(15, 308, 119, -1));
jPanel1.add(jButton3, new XYConstraints(257, 167, 105, -1));
jPanel1.add(jButton5, new XYConstraints(257, 308, 104, -1));
jPanel1.add(jButton1, new XYConstraints(14, 166, 120, 32));
this.getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
setSize(450,550);
setVisible(true);
}
JPanel jPanel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
public void jButton5_actionPerformed(ActionEvent e) {
setVisible(false);
userlogin u=new userlogin();
}
public void jButton2_actionPerformed(ActionEvent e) {
setVisible(false);
Fecth fecth=new Fecth();
}
public void jButton1_actionPerformed(ActionEvent e) {
setVisible(false);
Keep keep=new Keep();
}
public void jButton3_actionPerformed(ActionEvent e) {
setVisible(false);
Changepwd change=new Changepwd();
}
public void jButton4_actionPerformed(ActionEvent e) {
setVisible(false);
Showall sa=new Showall();
userlogin u=new userlogin();
u.setVisible(false);
String yy=u.s;
try{
String url = "jdbc:odbc:atm";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
ResultSet rs = null;
Connection dbConn = DriverManager.getConnection(url,database_username, database_password);
Statement stmt = dbConn.createStatement();
strSql="select * from transinfo where cardid='"+yy+"'";
rs= stmt.executeQuery(strSql);
JOptionPane.showMessageDialog(this, "时间:'"+rs.getDate(1) +"'卡号:'"+
rs.getString(2)+"''"+rs.getString(3)+"':'"+rs.getInt(4)+"'");
rs.close();
stmt.close();
dbConn.close();
}catch(Exception ex){
ex.getMessage();
}
}
}
class Function_jButton4_actionAdapter implements ActionListener {
private Function adaptee;
Function_jButton4_actionAdapter(Function adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
class Function_jButton3_actionAdapter implements ActionListener {
private Function adaptee;
Function_jButton3_actionAdapter(Function adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class Function_jButton1_actionAdapter implements ActionListener {
private Function adaptee;
Function_jButton1_actionAdapter(Function adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class Function_jButton2_actionAdapter implements ActionListener {
private Function adaptee;
Function_jButton2_actionAdapter(Function adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class Function_jButton5_actionAdapter implements ActionListener {
private Function adaptee;
Function_jButton5_actionAdapter(Function adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton5_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -