📄 demandbalance.java
字号:
/******************************************
* <p>Title: ATM自动取款机</p>
*
* <p>Description: 模拟</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author vinky_sc
* @version 1.0
*****************************************/
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.UIManager;
import java.awt.Font;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Toolkit;
import java.awt.Dimension;
/*****************************************
* 查询余额窗口(功能窗口)
*
* 查询客户对应卡上的余额
*****************************************/
public class DemandBalance extends JFrame {
Client user = new Client();
atmScreen main = new atmScreen();
JLabel jLabel1 = new JLabel();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
public DemandBalance() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
String id = main.aa; //获取客户当前卡号
float bal = user.querybalance(id); //查询对应卡号上的余额
getContentPane().setLayout(xYLayout1);
jLabel1.setBackground(UIManager.getColor("ComboBox.selectionBackground"));
jLabel1.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
this.setResizable(false);
setSize(new Dimension(400, 330));
setTitle("模拟ATM自动取款机--查询余额");
jLabel1.setToolTipText("");
jLabel1.setText("欢迎使用ATM自动取款机");
this.getContentPane().setBackground(Color.lightGray);
jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel2.setText(" 尊敬的用户");
jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel3.setText(" 你帐户的余额是:");
jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel4.setText(" ¥ "+bal); //将余额显示在银幕上
jButton1.setText("更多服务");
jButton1.addActionListener(new DemandBalance_jButton1_actionAdapter(this));
jButton2.setText("退 卡");
jButton2.addActionListener(new DemandBalance_jButton2_actionAdapter(this));
this.getContentPane().add(jLabel1, new XYConstraints(108, 20, 185, 35));
this.getContentPane().add(jButton2, new XYConstraints(232, 214, 95, 30));
this.getContentPane().add(jButton1, new XYConstraints(77, 214, 95, 30));
this.getContentPane().add(jLabel4, new XYConstraints(136, 150, 156, 35));
this.getContentPane().add(jLabel2, new XYConstraints(61, 71, 109, 35));
this.getContentPane().add(jLabel3, new XYConstraints(89, 112, 166, 35));
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
this.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
this.setVisible(true);
}
public void jButton2_actionPerformed(ActionEvent e) {
new ATM();
this.dispose();
}
public void jButton1_actionPerformed(ActionEvent e) {
new menu().setVisible(true);
this.dispose();
}
}
class DemandBalance_jButton2_actionAdapter implements ActionListener {
private DemandBalance adaptee;
DemandBalance_jButton2_actionAdapter(DemandBalance adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class DemandBalance_jButton1_actionAdapter implements ActionListener {
private DemandBalance adaptee;
DemandBalance_jButton1_actionAdapter(DemandBalance adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -