基于java+mysql的swing+mysql银行管理系统+文档java基础gui(java+gui)

基于java+mysql的swing+mysql银行管理系统+文档java基础gui(java+gui)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于java+mysql的Swing+MySQL银行管理系统+文档java基础gui(java+gui)

功能介绍:

登录、打印、取款、改密、转账、查询、挂失、存款、退卡

 */
public class AddInformation extends JFrame implements ActionListener, DocumentListener{
   
         private JLabel accountNameLabel, accountPasswordLabel, chineseNameLabel, cardNumberLabel, balanceLabel, managerLabel;//定义数据库中各表头的标签
         private JTextField accountNameTextField, accountPasswordTextField, chineseNameTextField, cardNumberTextField, balanceTextField, managerTextField;//定义数据库中各表头的文本域
         private JButton confirmButton, returnButton;//确认按钮, 返回按钮
         private JPanel accountNamePanel, accountPasswordPanel, chineseNamePanel, cardNumberPanel, balancePanel, managerPanel, buttonPanel;//定义数据库中各表头的面板
         private String accountNameTemp, accountPasswordTemp, chineseNameTemp, cardNumberTemp, balanceTemp, managerTemp;//缓存
         private int selectedRowTemp;//存起构造方法中的形参
         private JTable tableTemp;//存起构造方法中的形参
         private Dao dao = new Dao(); //实例化数据库操作类
         
         public AddInformation(Account user, JTable table) {
   
        	 tableTemp = table;
//        	 selectedRowTemp = selectedRow;
//        	 System.out.println("选中的行的用户为" + table.getValueAt(selectedRowTemp, 2));//测试代码
        	 
        	 //设置窗体
        	 this.setTitle("管理员添加信息");
         	 this.setVisible(true);
         	 this.setSize(400, 400);
         	 this.setLocationRelativeTo(null);//在屏幕中间居中显示
         	 this.setLayout(null);//设置空布局
         	 
         	//设置更新后的Account对象
         	dao.setTheAccount(user);//使得后面调用Account对象的setter方法和getter方法,都是最新的值
         	
         	//初始化标签
         	accountNameLabel = new JLabel("用       户:");
         	accountPasswordLabel = new JLabel("密       码:");
         	chineseNameLabel = new JLabel("中 文 名:");
         	cardNumberLabel = new JLabel("卡       号:");
         	balanceLabel = new JLabel("余       额:");
         	managerLabel = new JLabel("是否管理员(填yes或no):");
        	
         	//初始化文本域
         	accountNameTextField = new JTextField(16);
         	accountPasswordTextField = new JTextField(20);
         	chineseNameTextField = new JTextField(10);
         	cardNumberTextField = new JTextField(20);
        	balanceTextField = new JTextField(10);
        	managerTextField = new JTextField(10);
        	 
        

        	//添加文本域事件
        	accountNameTextField.getDocument().addDocumentListener(this);
        	accountPasswordTextField.getDocument().addDocumentListener(this);
 * 登录密码界面类
 */
public class Login extends JFrame {
   
	  private JFrame frame; //主窗体
	  private Container container; //容器
	  private JPanel titlePanel, userPanel, passwordPanel, buttonPanel; //标题面板,密码面板,按钮面板
	  
      private JLabel userLabel, passwordLabel, titleLabel; //密码标签,标题标签
      private JTextField userTextField; //用户文本域S
      private JPasswordField passwordField; //密码文本域
      private JButton loginButton, registerButton, forgetPasswordButton, exitButton; //确认按钮,注册按钮,忘记密码按钮,退出按钮
      private static Account user; //账户实例对象
      private Dao dao = new Dao(); //实例化数据库操作类
      
      public static Account getUser() {
    //user的get属性方法
    	  return user;
      }
     
      
      
    //无参构造
	public Login() {
   
		// TODO Auto-generated constructor stub
		//设置主窗体
		frame = new JFrame("Java银行系统");
		frame.setSize(400, 300); //设置窗口大小
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //点击关闭按钮可以关闭窗口
		frame.setVisible(true); //设置窗口可见
		frame.setLocationRelativeTo(null);//在屏幕中间居中显示
		//设置标签
		titleLabel = new JLabel("欢迎使用本系统!");
		userLabel = new JLabel("用户名:");
		passwordLabel = new JLabel("密  码:");
		
		//设置标题标签的字体
		titleLabel.setFont(new Font("黑体", Font.BOLD, 30));
		
		//设置文本域
		userTextField = new JTextField(20);
		passwordField = new JPasswordField(20);
		
		//给文本域添加事件
		passwordField.addKeyListener(new MyFieldEvent());
		
		//设置按钮
		loginButton = new JButton("登录");
		registerButton = new JButton("注册");
		forgetPasswordButton = new JButton("忘记密码");
		exitButton  = new JButton("退出");
        	 selectedRowTemp = selectedRow;
//        	 System.out.println("选中的行的用户为" + table.getValueAt(selectedRowTemp, 2));//测试代码
        	 
        	 //设置窗体
        	 this.setTitle("管理员修改信息");
         	 this.setVisible(true);
         	 this.setSize(400, 400);
         	 this.setLocationRelativeTo(null);//在屏幕中间居中显示
         	 this.setLayout(null);//设置空布局
         	 
         	//设置更新后的Account对象
         	dao.setTheAccount(user);//使得后面调用Account对象的setter方法和getter方法,都是最新的值
         	
         	//初始化标签
         	accountNameLabel = new JLabel("用       户:");
         	accountPasswordLabel = new JLabel("密       码:");
         	chineseNameLabel = new JLabel("中 文 名:");
         	cardNumberLabel = new JLabel("卡       号:");
         	balanceLabel = new JLabel("余       额:");
         	managerLabel = new JLabel("是否管理员(填yes或no):");
        	
         	//初始化文本域
         	accountNameTextField = new JTextField(16);
         	accountPasswordTextField = new JTextField(20);
         	chineseNameTextField = new JTextField(10);
         	cardNumberTextField = new JTextField(20);
        	balanceTextField = new JTextField(10);
        	managerTextField = new JTextField(10);
        	 
        	//设置文本域
        	accountNameTextField.setText(table.getValueAt(selectedRow, 0).toString());
//        	System.out.println("accountNameTextField为" + accountNameTextField.getText());//测试代码
        	accountPasswordTextField.setText(table.getValueAt(selectedRow, 1).toString());
        	chineseNameTextField.setText(table.getValueAt(selectedRow, 2).toString());
        	cardNumberTextField.setText(table.getValueAt(selectedRow, 3).toString());
        	balanceTextField.setText(table.getValueAt(selectedRow, 4).toString());
        	managerTextField.setText(table.getValueAt(selectedRow, 5).toString());

        	//添加文本域事件
        	accountNameTextField.getDocument().addDocumentListener(this);
        	accountPasswordTextField.getDocument(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值