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

📄 actionchoice.java

📁 java 版ATM 系统 注册登陆 存取!!!据对经典
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ActionChoice extends JFrame implements ActionListener{

	JPanel panel1 ;
	JLabel labelbj,labeltopic,infolabel;
	JButton SaveBtn,OutBtn,BalanceBtn,UserinfoBtn,returnBtn,ExitBtn,PwchangeBtn;
	Account acc;
	Userinfo user;
	String info;
	
	public ActionChoice(Account a1, Userinfo u1)
	{
		acc=a1;
		user=u1;
        GridBagLayout layout = new GridBagLayout();
        setLayout(layout);
        labeltopic = new JLabel("   ");
        infolabel = new JLabel("  ");
        SaveBtn = new JButton("存   钱");
	    OutBtn = new JButton("取   钱");
	    BalanceBtn = new JButton("查询余额");
	    UserinfoBtn = new JButton("用户信息");
	    ExitBtn = new JButton("安全退出");
	    PwchangeBtn=new JButton("修改密码");
	    returnBtn = new JButton ("返回上一层");
	    labelbj  = new JLabel(); 
		ImageIcon img = new ImageIcon( "bj04.jpg "); 
		labelbj.setIcon(img); 
		getLayeredPane().add(labelbj, new Integer(Integer.MIN_VALUE));
		labelbj.setBounds(0,0,img.getIconWidth(), img.getIconHeight());
		((JPanel)getContentPane()).setOpaque(false); 
	    
		  
		   SaveBtn.addActionListener(this);
		   OutBtn.addActionListener(this);
		   BalanceBtn.addActionListener(this);
		   UserinfoBtn.addActionListener(this);
		   ExitBtn.addActionListener(this);
		   PwchangeBtn.addActionListener(this);
		   returnBtn.addActionListener(this);


	  // 设置布局都是在这里实现的。。。。
          add(labeltopic, new GBC(0, 0,2,1));   
          add(infolabel, new GBC(0, 2,2,3)); 
          add(SaveBtn, new GBC(0, 1).setWeight(100, 100));         
          add(OutBtn, new GBC(1, 1).setWeight(100, 100));       
          add(BalanceBtn, new GBC(2, 1).setWeight(100, 100));          
          add(UserinfoBtn, new GBC(0, 5).setWeight(100, 100));    
          add(ExitBtn, new GBC(3,5).setWeight(100, 100));
          add(PwchangeBtn, new GBC(3,1).setWeight(100, 100));
          add(returnBtn, new GBC(1,5).setWeight(100, 100));
          
          setSize(500,480);
		  setLocation(250,250);
		
		// 设置这个窗体关闭按钮的操作. 这里是设置为弹出对话框,并关闭整个系统!
		 this.addWindowListener(new WindowAdapter()
			{
			 public void windowClosing(WindowEvent e)
				{
					JOptionPane.showMessageDialog(null," 关闭整个系统!");
					System.exit(0);
				}
			}
		 );

	}

	public void actionPerformed(ActionEvent e) {
		// TODO 自动生成方法存根
		if(e.getSource()== SaveBtn)
		{
			acc.Save();
		}
		else if(e.getSource()== OutBtn)
		{
			acc.Out();
		}
		else if(e.getSource()== BalanceBtn)
		{
			String str = "您当前的余额为: " +acc.getAmount();
			JOptionPane.showMessageDialog(null,str);
		}

		else if(e.getSource()== UserinfoBtn)
		{
			
			
			info = "<html><font color=blue><p>您的用户信息:</p><p>姓  名: "+user.Getname()+"</p><p>性  别: "+user.Getsex()+"</p><p>身份证号:"+user.Getidnum()+"</p><p>手机号码:"+user.Getphonenum()+"</p><p>地  址:"+user.Getaddress()+"</p><p>邮政编码:"+user.Getpostcode()+"</p>" +
					"<p>密码:"+acc.getPassword()+"</p><</font></html>";
			infolabel.setText(info);
		}
		else if(e.getSource()== PwchangeBtn)
		{
              acc.Pwchange();
		}
		else if(e.getSource()== ExitBtn)
		{
			JOptionPane.showMessageDialog(null,"谢谢使用ATM系统");
			System.exit(0);
		}
		else if(e.getSource()== returnBtn)
		{
			MainFrame  mainframe = new MainFrame();
			mainframe.setVisible(true);
			this.setVisible(false);

		}
	}
public class mo()
{
	Mai}

⌨️ 快捷键说明

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