selectaccountpanel.java

来自「没有使用集成开发环境」· Java 代码 · 共 57 行

JAVA
57
字号
package ATMClient.ClientUI;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;
public class SelectAccountPanel extends JPanel{
	JButton creditCard=null;  
	JButton currentDeposit=null;
	JButton fixedDeposit=null; 
	private OnClick dp;
	public SelectAccountPanel(OnClick dsp)
	{
		dp=dsp;
		creditCard=new JButton("信用卡账户");
		creditCard.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e)
			{
				//System.exit(0);
				dp.creditCard_click();
			}
		});
		currentDeposit=new JButton("活期账户");
		currentDeposit.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e)
			{
				dp.currentDeposit_click();
			}
		});
		fixedDeposit=new JButton("定期账户");
		fixedDeposit.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e)
			{
				dp.fixedDeposit_click();
			}
		});
		this.setLayout(null);
		creditCard.setSize(180,50);
		creditCard.setLocation(200,70);
		currentDeposit.setSize(180,50);
		currentDeposit.setLocation(200,190);
		fixedDeposit.setSize(180,50);
		fixedDeposit.setLocation(200,310);
		this.add(creditCard);
		this.add(currentDeposit);
		this.add(fixedDeposit);
	}
	/*
	 * 按钮按下事件处理接口
	 * */
	public interface OnClick
	{
		public void  creditCard_click();
		public void  currentDeposit_click();
		public void  fixedDeposit_click();
	}
}

⌨️ 快捷键说明

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